Skip to content

fix(landing): stop reporting unverified services as green on /health - #195

Open
Rumblingb wants to merge 1 commit into
fix/landing-routing-404-prfrom
fix/health-truthful-status
Open

fix(landing): stop reporting unverified services as green on /health#195
Rumblingb wants to merge 1 commit into
fix/landing-routing-404-prfrom
fix/health-truthful-status

Conversation

@Rumblingb

Copy link
Copy Markdown
Owner

Closes the /health half of #165. Stacks on #193, which fixes the routing half.

What was live

Verified against production on 2026-07-27:

$ curl -s https://agentpay.so/health
{"status":"ok","services":{"database":"green","agentrank":"green","escrow":"green",
"kya":"green","behavioral_oracle":"green"},"timestamp":"2026-07-27T16:22:25.670Z"}

Five services, all hard-coded green, none verifiable. This is an edge worker — it has no
backend probe and never had one. Per #167, no payment rail is provably live at all, so
escrow and kya were not merely unverified, they were unimplemented.

This is the most damaging item in #165. The landing copy is marketing and reads as such;
a status endpoint reads as an assertion of fact, and it is the first thing a technical
evaluator checks.

Separately, the old condition matched /api/health too, so the stub shadowed the origin's
real health check
— the one endpoint that could have told the truth was unreachable.

What it returns now

{
  "status": "ok",
  "scope": "edge",
  "services": {
    "landing": "green",
    "agentrank": "demo_only",
    "database": "not_probed",
    "escrow": "not_implemented",
    "kya": "not_implemented",
    "behavioral_oracle": "not_implemented"
  },
  "note": "Edge worker status only. Backend health is served by the origin at /api/health.",
  "timestamp": "2026-07-27T16:34:32.115Z"
}

landing is green because this worker genuinely does serve it. Nothing else may claim green.

Changes

  • EDGE_SERVICE_STATUS constant holds the declared states, with a comment stating the rule:
    green requires a deployed, tested implementation on this worker; anything else is
    not_implemented. One place to audit, and the next person cannot re-add a green by reflex.
  • scope: "edge" + note so the payload declares its own limits rather than implying
    system-wide coverage.
  • /api/health no longer handled here — falls through to the existing /api/ origin
    passthrough, so real backend health is reachable.
  • Cache-Control: no-store. A status response should never be served stale.

Verification

  • node --check worker.js → clean
  • node --test worker.test.mjs → 1/1 pass

Tests added:

  • every service other than landing is asserted not green, by loop — so a future
    regression fails even for a service name that does not exist yet
  • each state asserted individually
  • /api/health reaches the origin (status 299 from the stubbed fetch, fetchCalled true)
  • no-store present

Base branch

Targets codex/founder-orchestration-2026-07-11 for the same reason as #193: the landing
worker does not exist on main. Branched from #193's head so the two apply in order and
touch disjoint code — #193 owns routing, this owns the health payload.

Not in scope

Making database a real probe. That needs an origin health contract that does not exist
yet and belongs with #167/#168. not_probed is the honest placeholder until then — the
point of this PR is that an unknown must not be reported as a green.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agentpay-dashboard Error Error Jul 27, 2026 4:37pm
agentpay-docs Error Error Jul 27, 2026 4:37pm
agentpay-host-native-restore Ready Ready Preview, Comment Jul 27, 2026 4:37pm

@Rumblingb
Rumblingb changed the base branch from codex/founder-orchestration-2026-07-11 to fix/landing-routing-404-pr July 27, 2026 16:36
/health returned a hard-coded `green` for database, agentrank, escrow, kya and
behavioral_oracle. None of those are verifiable from this edge worker, and per #167
no payment rail is provably live at all. Verified against production today: the live
endpoint still serves all five as green.

This is the specific overclaim #165 was filed to remove. It is also the most damaging
one, because /health is exactly what a technical evaluator checks first — the landing
copy is marketing, but a status endpoint reads as an assertion of fact.

Changes:
- Declare service states in EDGE_SERVICE_STATUS with honest values: landing green
  (this worker does serve it), agentrank demo_only, database not_probed, escrow /
  kya / behavioral_oracle not_implemented.
- Add `scope: "edge"` and a note so the payload states its own limits.
- Stop handling /api/health here. It was shadowing the origin's real health check,
  which now receives the request via the existing /api/ passthrough.
- Cache-Control: no-store, so a status response is never served stale.

Tests assert no service other than `landing` may report green, and that /api/health
reaches the origin.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Rumblingb

Copy link
Copy Markdown
Owner Author

Two follow-ups after review:

Base corrected. Originally opened against codex/founder-orchestration-2026-07-11, which is #193's base, not its branch — so the diff was the union of both PRs and reviewing this one meant re-reviewing #193. Rebased onto fix/landing-routing-404-pr. Now 1 commit, 2 files, exactly the health change.

/api/health passthrough verified against the origin. The test stubs globalThis.fetch, so it proves the passthrough fires, not that the origin answers. Checked the origin directly — it does:

  • apps/api-edge/src/routes/health.ts:101router.get('/api/health', healthHandler)
  • apps/api-edge/src/index.ts:106if (path === '/health' || path === '/api/health' || path === '/api')
  • apps/api-edge/src/middleware/globalPause.ts:24/api/health is in PAUSE_EXEMPT_PATHS, so it answers even under a global pause

So removing the edge stub hands /api/health to a real handler rather than turning it into a 404.

Unused export dropped. EDGE_SERVICE_STATUS was added to module.exports and nothing imported it — the tests assert against the response body, not the constant. Removed. Force-pushed as 07c1599; node --check clean and node --test worker.test.mjs 1/1 pass after the change.

@Rumblingb

Copy link
Copy Markdown
Owner Author

Deployed to production — 2026-07-27

Worker agentpay-landing-production, version bb94ad2e-799b-48d9-bee5-c8846c311315.
Routes: agentpay.so/*, www.agentpay.so/*. Rollback target: 07f801ff-4fd0-4792-a378-437bb3f05e76.

Ships both this PR and #193 (which it stacks on).

Before

$ curl -s https://agentpay.so/health
{"status":"ok","services":{"database":"green","agentrank":"green","escrow":"green",
"kya":"green","behavioral_oracle":"green"},...}

/docs   200   (landing fallback)
/start  200   (landing fallback)

After — verified live

$ curl -s https://agentpay.so/health
{"status":"ok","scope":"edge","services":{"landing":"green","agentrank":"demo_only",
"database":"not_probed","escrow":"not_implemented","kya":"not_implemented",
"behavioral_oracle":"not_implemented"},
"note":"Edge worker status only. Backend health is served by the origin at /api/health.",...}

/api/health now reaches the origin and returns the real backend check rather than the edge stub:

$ curl -s https://agentpay.so/api/health
{"status":"active","services":{"database":{"status":"operational"},...},"version":"1.0.0"}

Routing verification

The first pass appeared to show /nonexistent-xyz123 still returning 200. That was Cloudflare edge cache holding the pre-deploy response, not a failed deploy. Re-checked with cache-busting query strings:

path status
/ 200
/health 200
/privacy, /terms 200
/docs 404
/start?cb=… 404
/zz-probe-* (3 random) 404

Unknown paths carry Cache-Control: public, max-age=300 and X-Content-Type-Options: nosniff.

Deploy notes

  • node --test worker.test.mjs → pass, immediately before deploy
  • wrangler deploy → 64.57 KiB / 17.16 KiB gzip, upload 5.61s, triggers 3.90s
  • Wrangler warned the token lacks All Zones and fell back to per-zone route updates. Both routes bound correctly; routes in zones the token cannot see would not have been touched — there are none for this Worker.

Copy link
Copy Markdown
Owner Author

Not merged — blocked by failing checks, and blocked behind #193.

Commit 07c1599: 2 of 3 status checks are red —

Same pattern as #193 — this PR only touches workers/agentpay-landing/worker.js and its test file, not apps/docs or dashboard/, so these failures look pre-existing/unrelated rather than caused by this diff. No merge conflict. Holding per repo hygiene policy (no merge on red checks); also needs #193 merged first since this stacks on it. Please confirm the two Vercel failures are known-unrelated (or fix them), then this can merge right after #193.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant