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

Defect on the v1.0.0 path: production's /api/v1/keeper/pulse answers {at:null} on the running release, so the keeper line of the v1 probe is still UNKNOWN #15532

Merged opened this

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

Merged

Production's /api/v1/keeper/pulse said {at:null} because no release tick ever ran there to record a beat, not because beats were stored somewhere heartbeatOf doesn't read.

Notes

shipped production is serving it deploy 3fede26

opened this

Production's /api/v1/keeper/pulse said {at:null} because no release tick ever ran there to record a beat, not because beats were stored somewhere heartbeatOf doesn't read. Production is this forge running as an app of its host forge: FORGE_RELEASE_KEEPER is off, the in-process keeper never starts, and no forge-release-tick host timer posts to /api/v1/release/heartbeat. So keeper_beat_tick stayed empty for good, and the pulse couldn't tell "hasn't ticked yet" from "never will". I checked that production holds the host's identity key: an unsigned POST /jobs/heartbeat gets the "unsigned" refusal, not "not run by another".

What changed

  • New tick, src/keeper/hosted_tick.ts:
    • releasedByHost(env) is true only when FORGE_APP_IDENTITY_KEY is set and FORGE_RELEASE_KEEPER is neither on nor swap.
    • hostedStep() reports skipped and says why: the host forge deploys the default branch on every merge, and the in-process keeper is off.
  • Wiring, src/main.ts: where the keeper is off, a hosted forge runs stepWithBeat(app.db, hostedStep) at boot and then every hour (HOSTED_EVERY_MS, well under SILENT_MS). The pulse is {at:null} only until that first tick, which runs at boot, and it never goes silent while the process is up. Beats go through the existing recordBeat, which keeps the last 50.
  • Where it doesn't run: on a forge that isn't hosted (for example the host forge itself, whose beats come from its host timer), so a dead timer still shows up to the quiet-release alarm. It also doesn't run when the keeper was asked for but is misconfigured, so that warning isn't covered up.
  • Tests:
    • A new block in test/keeper-pulse.test.ts (an existing file, so the gate list doesn't change). It covers the env rule, checks the pulse is {at:null} before the tick, then that a hosted tick returns {at, outcome:"skipped", silent:false} with no reason, and that the probe reads that as PASS.
    • test/job-slices.test.ts names the new release-hosted job. That suite failed until I added it.

Not done

  • I left the public pulse, the release workflow and the chart as they were.
  • The boot-time wiring in main.ts has no test of its own; the tests cover the step and the env rule.

Checks run: bun scripts/gate.ts --fix (no changes), bun x tsc --noEmit, test/mcp-size.test.ts, and the 122 files scripts/fast.ts named: one failed (job-slices), it passed after the fix, and I re-ran it with the pulse suite.

Try it: once this is live, curl https://lab--forge-trevato-apps.open-platform.sh/api/v1/keeper/pulse should answer {"at":"…","outcome":"skipped","silent":false}, and the keeper line of bun scripts/v1-probe.ts https://lab--forge-trevato-apps.open-platform.sh should print PASS. Keep #15530 open until it does.

🤖 Generated with Claude Code

Closes #15530

3 earlier comments · 2 events
commented

Production's /api/v1/keeper/pulse said {at:null} because no release tick ever ran there to record a beat, not because beats were stored somewhere heartbeatOf doesn't read. Production is this forge running as an app of its host forge: FORGE_RELEASE_KEEPER is off, the in-process keeper never starts, and no forge-release-tick host timer posts to /api/v1/release/heartbeat. So keeper_beat_tick stayed empty for good, and the pulse couldn't tell "hasn't ticked yet" from "never will". I checked that production holds the host's identity key: an unsigned POST /jobs/heartbeat gets the "unsigned" refusal, not "not run by another".

What changed

  • New tick, src/keeper/hosted_tick.ts:
    • releasedByHost(env) is true only when FORGE_APP_IDENTITY_KEY is set and FORGE_RELEASE_KEEPER is neither on nor swap.
    • hostedStep() reports skipped and says why: the host forge deploys the default branch on every merge, and the in-process keeper is off.
  • Wiring, src/main.ts: where the keeper is off, a hosted forge runs stepWithBeat(app.db, hostedStep) at boot and then every hour (HOSTED_EVERY_MS, well under SILENT_MS). The pulse is {at:null} only until that first tick, which runs at boot, and it never goes silent while the process is up. Beats go through the existing recordBeat, which keeps the last 50.
  • Where it doesn't run: on a forge that isn't hosted (for example the host forge itself, whose beats come from its host timer), so a dead timer still shows up to the quiet-release alarm. It also doesn't run when the keeper was asked for but is misconfigured, so that warning isn't covered up.
  • Tests:
    • A new block in test/keeper-pulse.test.ts (an existing file, so the gate list doesn't change). It covers the env rule, checks the pulse is {at:null} before the tick, then that a hosted tick returns {at, outcome:"skipped", silent:false} with no reason, and that the probe reads that as PASS.
    • test/job-slices.test.ts names the new release-hosted job. That suite failed until I added it.

Not done

  • I left the public pulse, the release workflow and the chart as they were.
  • The boot-time wiring in main.ts has no test of its own; the tests cover the step and the env rule.

Checks run: bun scripts/gate.ts --fix (no changes), bun x tsc --noEmit, test/mcp-size.test.ts, and the 122 files scripts/fast.ts named: one failed (job-slices), it passed after the fix, and I re-ran it with the pulse suite.

Try it: once this is live, curl https://lab--forge-trevato-apps.open-platform.sh/api/v1/keeper/pulse should answer {"at":"…","outcome":"skipped","silent":false}, and the keeper line of bun scripts/v1-probe.ts https://lab--forge-trevato-apps.open-platform.sh should print PASS. Keep #15530 open until it does.

🤖 Generated with Claude Code

commented

Production's /api/v1/keeper/pulse answered {at:null} because no release tick ever ran there, so nothing recorded a beat. Production is this forge running as an app of its host forge: FORGE_RELEASE_KEEPER is off, so the in-process keeper never starts, and no forge-release-tick host timer posts to /api/v1/release/heartbeat. The beat table stayed empty, and the pulse couldn't tell "hasn't ticked yet" from "never will". An unsigned POST /jobs/heartbeat to production gets the "unsigned" refusal, which shows production has FORGE_APP_IDENTITY_KEY set, so the new tick will run there.

What changed

  • src/keeper/beat.ts: two additions next to stepWithBeat:
    • releasedByHost(env) is true only when FORGE_APP_IDENTITY_KEY is set and FORGE_RELEASE_KEEPER is neither on nor swap.
    • hostedStep() reports skipped and says why: the host forge deploys the default branch on every merge, and the in-process keeper is off.
  • src/main.ts: where the keeper is off and releasedByHost holds, the forge runs stepWithBeat(app.db, hostedStep) at boot and then every hour (HOSTED_EVERY_MS, well under SILENT_MS). The pulse is {at:null} only until that first tick, and it never goes silent while the process runs.
  • Where it doesn't run: on a forge that isn't hosted, whose beats come from its own host timer, so a dead timer still trips the quiet-release alarm. It also doesn't run when the keeper was asked for but is misconfigured.
  • Tests:
    • A new block in test/keeper-pulse.test.ts (an existing file, so the gate list is unchanged). It covers the env rule and the interval, checks the pulse is {at:null} before a tick, then that a hosted tick returns {at, outcome:"skipped", silent:false} with no reason, and that the probe reads that as PASS.
    • test/job-slices.test.ts names the new release-hosted job.

The first push failed the gate's "pipeline first" rule, which counts any new src/ module as a feature. Rather than add a waiver to a defect fix, the second commit moved the code from its own src/keeper/hosted_tick.ts into beat.ts.

Not done

  • The public pulse's shape, the release workflow and the chart are unchanged.
  • The boot-time wiring in main.ts has no test of its own; the step and the env rule are tested.

Checks run: bun scripts/gate.ts passes and --fix changed nothing. bun x tsc --noEmit, test/keeper-pulse.test.ts, test/job-slices.test.ts and test/mcp-size.test.ts all pass. Before the move, the 122 files scripts/fast.ts named also passed once job-slices named the new job.

Try it: once this is live, curl https://lab--forge-trevato-apps.open-platform.sh/api/v1/keeper/pulse should answer {"at":"…","outcome":"skipped","silent":false}, and the keeper line of bun scripts/v1-probe.ts https://lab--forge-trevato-apps.open-platform.sh should print PASS. Keep #15530 open until it does.

🤖 Generated with Claude Code

Changes requested — before the latest push

The step and the env rule are tested, but the preview of this head still answers {"at":null} on /api/v1/keeper/pulse. Boot wiring is the part that fixes the defect, and neither the preview nor any test shows it running. Fix first: make the boot wiring provable. Extract the wiring from main.ts into a small function (for example startHostedTick(db, env, log) in beat.ts) that runs the first tick immediately and schedules the interval. Test that, with FORGE_APP_IDENTITY_KEY set, calling it leaves a beat and the pulse stops being {at:null}. Then confirm the preview pulse shows {at,outcome:skipped,silent:false}; if the preview has no FORGE_APP_IDENTITY_KEY, say so in the pull and prove it another way. Also: (1) a bare setInterval in main.ts is not tracked or cleared on shutdown; use whatever timer pattern the sibling jobs use. (2) hostedStep is async with no await. (3) The beat is 'skipped' by construction, so the probe's PASS proves the process is alive, not that releases flow. Say that plainly in the beat line or the pull so nobody reads PASS as a proven release path.

commented

Production answered {at:null} on /api/v1/keeper/pulse because no release tick ever runs there. It is this forge running as an app of its host forge, so FORGE_RELEASE_KEEPER is off and no forge-release-tick host timer posts a heartbeat. On a hosted forge, a tick now records a skipped beat at boot and every hour after.

What changed

  • src/keeper/beat.ts:
    • releasedByHost(env) is true only when FORGE_APP_IDENTITY_KEY is set and FORGE_RELEASE_KEEPER is neither on nor swap.
    • hostedStep() is now a plain function. Its beat says it is "released by the host forge's deploy of the default branch, not by this tick; this beat shows the forge is up, not that a release went through".
    • startHostedTick(db, env, repeat, now?) writes the first beat before it returns, so {at:null} lasts only until boot finishes. It then schedules through repeat every HOSTED_EVERY_MS (an hour, well under SILENT_MS) and returns the stop. Off the host it starts nothing and returns undefined, so a dead host timer elsewhere still trips the quiet-release alarm.
  • src/main.ts: calls startHostedTick where the keeper is off. The interval is a setInterval wrapped in during("release-hosted", …), like the sibling jobs, and drain() calls stopHostedTick?.() beside landingsWatch(). The timer lives in main.ts because test/timers-named.test.ts requires every server-side timer callback to call during.
  • test/keeper-pulse.test.ts:
    • Off the host, nothing starts and the pulse stays {at:null}.
    • Hosted, the pulse answers {at, outcome:"skipped", silent:false} right after start. The interval is HOSTED_EVERY_MS, firing it writes a newer beat, the pulse has only those three keys, and stop clears it.
    • A fresh hosted beat is a PASS on the probe, and its stored reason says it is not a release.
  • test/job-slices.test.ts: names the release-hosted job.

The review points:

  • Preview: the preview has the host's identity key (an unsigned POST /jobs/heartbeat gets "unsigned", not "not run by another"). At head 293e00b it answered {"at":"2026-11-22T12:29:28.847Z","outcome":"skipped","silent":false}, about two seconds after its liveSince, so the {at:null} in the review was most likely from before that deploy. I haven't re-read the preview since this push.
  • Async with no await: hostedStep is now plain.
  • What PASS proves: a PASS on the keeper line proves the hosted forge is up and ticking, not that a release went through. Production's release path is the host forge's deploy on merge, which this tick neither drives nor sees. The beat's reason says so too, but only behind /api/v1/keeper, since the public pulse never shows a reason.

Not done: the pulse's shape, the release workflow and the chart are unchanged.

Checks run: bun scripts/gate.ts --fix (nothing left to commit), bun x tsc --noEmit, and keeper-pulse, job-slices, mcp-size and timers-named all pass. The 737 files scripts/fast.ts named for the previous commit ran with one failure, timers-named. The last commit fixes it, and that file passes now; I did not re-run the full list after it.

Try it: curl https://lab--15532--forge-trevato-apps.open-platform.sh/api/v1/keeper/pulse should answer {"at":"…","outcome":"skipped","silent":false}. After merge, the keeper line of bun scripts/v1-probe.ts https://lab--forge-trevato-apps.open-platform.sh should print PASS; keep #15530 open until it does.

🤖 Generated with Claude Code

Approved

Preview at this head answers {"at":"2026-11-22T12:46:06.935Z","outcome":"skipped","silent":false}. Diff since 293e00b: the tick moved into beat.ts with an injected repeat, main.ts wraps it in during("release-hosted") and drain stops it, job-slices names the job. Earlier asks met. Next: (1) add a boot-wiring test or at least assert main.ts passes process.env; (2) Non-blocking: say in docs that a PASS on the keeper line means up and ticking, not released.

commented

Left #15530 open: 1 unticked item remain (After it is live, the keeper line of bun scripts/v1-probe.ts https://lab--forge-trevato-apps.open-platform.sh prints PASS. Do not close the issue until it does.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs