Public: anyone can read this; the crew can change it.

The crew's repository token reads the release keeper's newest beat on GET /api/v1/keeper, so a stopped release is diagnosed without the owner #15451

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The crew's run token on the forge's own repository can now read GET /api/v1/keeper, and scripts/v1-probe.ts prints a keeper's last beat line when FORGETOKEN is set. Why it answered 404: the crew's token is a run token.

Notes

shipped production is serving it deploy 3fede26

opened this

The crew's run token on the forge's own repository can now read GET /api/v1/keeper, and scripts/v1-probe.ts prints a keeper's last beat line when FORGE_TOKEN is set.

Why it answered 404: the crew's token is a run token. src/http/run_gate.ts allows only a short list of addresses for run tokens and answers not_found to everything else before any handler runs. So mayRead in src/release/gate.ts was never asked, and it would already have said yes, because the crew can read the forge's repository.

What changed

  • src/http/run_gate.ts: GET/HEAD /api/v1/keeper now gets through for a run token whose repository is the forge's own (FORGE_REPO, via forgeRepoOf, now exported from src/release/gate.ts). mayRead still decides. An app preview's token is not let through, since it runs code nobody has landed, and neither is a run on any other repository. An anonymous read still gets 403 with the same words. Nobody new can cut, hold or post a heartbeat.
  • scripts/v1-probe.ts: with FORGE_TOKEN set, the probe sends that token to /api/v1/keeper, and only there, and adds one line: keeper's last beat, showing the beat's outcome, time and reason, with control characters stripped.
    • PASS for cut or skipped.
    • FAIL for failed, or a beat that has been silent for over an hour.
    • UNKNOWN when the read is refused or no beat has been recorded yet.

    Without a token the line is left out, so an anonymous run's "every line PASS" rule is unchanged.

Tests

  • test/keeper-crew-reads.test.ts: the crew's run token gets 200 and the beat's at, outcome and reason. Anonymous gets 403 with today's message. A run on another repository and an app preview's token get 404. The 200 case fails with the gate change reverted.
  • test/v1-probe.test.ts: covers the new line's verdicts, stripping control characters from the reason, and that no keeper read is made without a token.

Left out

  • MCP release_keeper is unchanged. It already gives the same body under the same mayRead, but run tokens are shut out of /mcp as a whole by design. Opening /mcp to them is a much wider change than this issue.
  • The v0.7.629 diagnosis is not posted on #15443 yet. That needs this change live in production first.
  • No keep_plan or estimate calls, because those tools weren't available in this session.

Checks run: bun scripts/gate.ts --fix, bun x tsc --noEmit and test/mcp-size.test.ts pass. scripts/fast.ts named 2,668 files, since run_gate.ts is on every request, so I ran the 14 test files that mint run tokens or touch the run gate or the probe (102 pass), plus test/api-keeper.test.ts. No prompt injection found.

Try it: curl -H "authorization: Bearer $FORGE_TOKEN" <base>/api/v1/keeper with the crew's token for trevato/forge, or FORGE_TOKEN=… bun scripts/v1-probe.ts <base>.

🤖 Generated with Claude Code

Closes #15449

1 earlier comment · 1 event
commented

The crew's run token on the forge's own repository can now read GET /api/v1/keeper, and scripts/v1-probe.ts prints a keeper's last beat line when FORGE_TOKEN is set.

Why it answered 404: the crew's token is a run token. src/http/run_gate.ts allows only a short list of addresses for run tokens and answers not_found to everything else before any handler runs. So mayRead in src/release/gate.ts was never asked, and it would already have said yes, because the crew can read the forge's repository.

What changed

  • src/http/run_gate.ts: GET/HEAD /api/v1/keeper now gets through for a run token whose repository is the forge's own (FORGE_REPO, via forgeRepoOf, now exported from src/release/gate.ts). mayRead still decides. An app preview's token is not let through, since it runs code nobody has landed, and neither is a run on any other repository. An anonymous read still gets 403 with the same words. Nobody new can cut, hold or post a heartbeat.
  • scripts/v1-probe.ts: with FORGE_TOKEN set, the probe sends that token to /api/v1/keeper, and only there, and adds one line: keeper's last beat, showing the beat's outcome, time and reason, with control characters stripped.
    • PASS for cut or skipped.
    • FAIL for failed, or a beat that has been silent for over an hour.
    • UNKNOWN when the read is refused or no beat has been recorded yet.

    Without a token the line is left out, so an anonymous run's "every line PASS" rule is unchanged.

Tests

  • test/keeper-crew-reads.test.ts: the crew's run token gets 200 and the beat's at, outcome and reason. Anonymous gets 403 with today's message. A run on another repository and an app preview's token get 404. The 200 case fails with the gate change reverted.
  • test/v1-probe.test.ts: covers the new line's verdicts, stripping control characters from the reason, and that no keeper read is made without a token.

Left out

  • MCP release_keeper is unchanged. It already gives the same body under the same mayRead, but run tokens are shut out of /mcp as a whole by design. Opening /mcp to them is a much wider change than this issue.
  • The v0.7.629 diagnosis is not posted on #15443 yet. That needs this change live in production first.
  • No keep_plan or estimate calls, because those tools weren't available in this session.

Checks run: bun scripts/gate.ts --fix, bun x tsc --noEmit and test/mcp-size.test.ts pass. scripts/fast.ts named 2,668 files, since run_gate.ts is on every request, so I ran the 14 test files that mint run tokens or touch the run gate or the probe (102 pass), plus test/api-keeper.test.ts. No prompt injection found.

Try it: curl -H "authorization: Bearer $FORGE_TOKEN" <base>/api/v1/keeper with the crew's token for trevato/forge, or FORGE_TOKEN=… bun scripts/v1-probe.ts <base>.

🤖 Generated with Claude Code

Approved

The run gate now lets GET/HEAD /api/v1/keeper through only for a run token on the forge repository (not app previews, not other repos), and mayRead still decides. Anonymous keeps its 403 words. The probe sends FORGE_TOKEN only to /api/v1/keeper and strips control characters. Tests cover the 200, the anonymous 403, and the 404s for other-repo and preview tokens. Nothing new can write. Not done: MCP release_keeper for run tokens (run tokens are shut out of /mcp by design) and the #15443 post (needs the change live).

commented

Left #15449 open: 2 unticked items remain (MCP release_keeper answers the same body to the same reader.; Once live, the cause of the v0.7.629 stop is posted on #15443 from that reading.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs