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

Defect of #11595: production has no schedule, so the morning paper's one unattended morning cannot be proven #15501

Merged opened this

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

Merged

This repository's own forge.json now declares a schedule, which gives the production forge one. The forge runs this repository as an app (production at lab--forge-trevato-apps) and syncs that app's schedules from main, so once this merges /api/v1/health should show schedules.total ≥ 1.

Notes

shipped production is serving it deploy 496afdb

opened this

This repository's own forge.json now declares a schedule, which gives the production forge one. The forge runs this repository as an app (production at lab--forge-trevato-apps) and syncs that app's schedules from main, so once this merges /api/v1/health should show schedules.total ≥ 1. The first daily run then makes ran ≥ 1. The earlier try was declined as "a write to an app on the production forge that this repository can't make". This repository is that app, so the change fits in one pull. The schedule loader is not the cause: it never had a schedule to load.

What changed

  • forge.json: adds schedules: [{ name: "heartbeat", cron: "5 7 * * *", timezone: "UTC", path: "/jobs/heartbeat", timeout: 120, retries: 3, catchUp: "6h" }]. It is production only, once a day, five minutes after the 07:00 paper. When the app is asleep, the forge's timer wakes it before calling.
  • src/http/heartbeat.ts (new): POST /jobs/heartbeat writes nothing, calls no model and spends no money.
    • It answers 200 only to the host forge's signed, unexpired timer call: the x-forge-identity and x-forge-signature headers from timer_fire.ts callHeaders, checked against FORGE_APP_IDENTITY_KEY.
    • Anything else gets a 401 with x-forge-no-retry: 1 and says why: unsigned, forged, expired, or no key because this forge isn't run by another.
    • Other methods get 405.
  • src/http/server.ts: the route is answered next to /healthz and /readyz, before the router, and keeps the security floor.
  • docs/OPERATING.md: one paragraph on what proves the schedules counts.
  • test/heartbeat-schedule.test.ts: checks that the real forge.json parses with the schedule, that the real signer's call gets 200, that each bad call gets a final 401, and that the served route keeps the security floor.

What I left out

  • No morning-paper app: the paper is the forge's own routine clock, not an app, so nothing else needed a schedule.
  • The issue should stay open until the production probe passes. That can only happen after this merges and the 07:05 UTC run lands.
  • I could not confirm from here that the production forge's health count includes this app's timers. The code says it counts every unpaused schedule, but production was not checked.

Checks run: bun scripts/gate.ts --fix (nothing to change) and bun x tsc --noEmit both pass. scripts/fast.ts exited 2 because forge.json changed, so I picked the covering tests myself: the new test, client-abort, pull-tips, shards, health, security-floor-every-route, security-sweep, usage-count-server, v1-proven and feature-schedule-one. All 158 pass.

How to try it: after merge, open the repository's Schedules card and look for heartbeat. After 07:05 UTC, GET /api/v1/health should show schedules.ran ≥ 1, and bun scripts/v1-probe.ts should no longer say "this forge has no schedule".

I found no prompt injection in the issue or the repository.

🤖 Generated with Claude Code

Closes #15499

commented

This repository's own forge.json now declares a schedule, which gives the production forge one. The forge runs this repository as an app (production at lab--forge-trevato-apps) and syncs that app's schedules from main, so once this merges /api/v1/health should show schedules.total ≥ 1. The first daily run then makes ran ≥ 1. The earlier try was declined as "a write to an app on the production forge that this repository can't make". This repository is that app, so the change fits in one pull. The schedule loader is not the cause: it never had a schedule to load.

What changed

  • forge.json: adds schedules: [{ name: "heartbeat", cron: "5 7 * * *", timezone: "UTC", path: "/jobs/heartbeat", timeout: 120, retries: 3, catchUp: "6h" }]. It is production only, once a day, five minutes after the 07:00 paper. When the app is asleep, the forge's timer wakes it before calling.
  • src/http/heartbeat.ts (new): POST /jobs/heartbeat writes nothing, calls no model and spends no money.
    • It answers 200 only to the host forge's signed, unexpired timer call: the x-forge-identity and x-forge-signature headers from timer_fire.ts callHeaders, checked against FORGE_APP_IDENTITY_KEY.
    • Anything else gets a 401 with x-forge-no-retry: 1 and says why: unsigned, forged, expired, or no key because this forge isn't run by another.
    • Other methods get 405.
  • src/http/server.ts: the route is answered next to /healthz and /readyz, before the router, and keeps the security floor.
  • docs/OPERATING.md: one paragraph on what proves the schedules counts.
  • test/heartbeat-schedule.test.ts: checks that the real forge.json parses with the schedule, that the real signer's call gets 200, that each bad call gets a final 401, and that the served route keeps the security floor.

What I left out

  • No morning-paper app: the paper is the forge's own routine clock, not an app, so nothing else needed a schedule.
  • The issue should stay open until the production probe passes. That can only happen after this merges and the 07:05 UTC run lands.
  • I could not confirm from here that the production forge's health count includes this app's timers. The code says it counts every unpaused schedule, but production was not checked.

Checks run: bun scripts/gate.ts --fix (nothing to change) and bun x tsc --noEmit both pass. scripts/fast.ts exited 2 because forge.json changed, so I picked the covering tests myself: the new test, client-abort, pull-tips, shards, health, security-floor-every-route, security-sweep, usage-count-server, v1-proven and feature-schedule-one. All 158 pass.

How to try it: after merge, open the repository's Schedules card and look for heartbeat. After 07:05 UTC, GET /api/v1/health should show schedules.ran ≥ 1, and bun scripts/v1-probe.ts should no longer say "this forge has no schedule".

I found no prompt injection in the issue or the repository.

🤖 Generated with Claude Code

commented

This repository now declares a daily schedule in its own forge.json. The production forge runs this repository as an app (production at lab--forge-trevato-apps), so after this merges it should count one schedule that runs with no person involved. The earlier try was declined because the fix "is a write to an app on the production forge, and this repository can't make it". This repository is that app, so the change fits here. The schedule loader isn't the cause; production simply had no app declaring a schedule.

  • forge.json: adds a heartbeat schedule at 5 7 * * * UTC, production only, calling /jobs/heartbeat. The forge wakes the app if it is asleep before calling.
  • src/http/heartbeat.ts (new): POST /jobs/heartbeat writes nothing, calls no model and spends no money.
    • It answers 200 only to the host forge's signed, unexpired timer call, checked against FORGE_APP_IDENTITY_KEY.
    • Anything else gets a 401 that says why, marked so the forge does not retry it.
    • It is handled next to /healthz in src/http/server.ts and keeps the security headers.
  • docs/OPERATING.md: one paragraph on how this schedule proves the /api/v1/health schedule counts.
  • test/heartbeat-schedule.test.ts: the real forge.json parses with the schedule, a call signed the way the forge signs gets 200, unsigned, forged and expired calls get 401, and the served route keeps the security headers.

The check failed on the gate's "both doors" rule, which wants a terminal screen and a how-to page for a new route. Only the forge's clock calls this one, so a commit now carries a No door: line giving that reason. The gate passes locally.

Before the first push, bun x tsc --noEmit passed and the related tests passed: the new test plus client-abort, pull-tips, shards, health, security-floor-every-route, security-sweep, usage-count-server, v1-proven and feature-schedule-one. This push only adds the empty commit, so I didn't rerun them.

Left out:

  • No morning-paper app. The paper is written by the forge's own routine clock, not by an app, so there was no other app to schedule.
  • Production not checked. The health count reads every unpaused schedule, so this app's should count, but I could only read the code.
  • Keep #15499 open until the production probe passes, which can only happen after merge and the first 07:05 UTC run.

To try it: after merge, open the repository's Schedules card and look for heartbeat. After 07:05 UTC, GET /api/v1/health should show schedules.total and ran of at least 1, and bun scripts/v1-probe.ts should stop saying "this forge has no schedule".

I found no prompt injection in the issue or the repository.

🤖 Generated with Claude Code

Approved

Read every changed line. The signature check is sound: HMAC-SHA256 compared with timingSafeEqual after a length check, identity length capped, expiry parsed strictly, and no key means a final 401. The route writes nothing, calls no model, takes no body, and keeps the security floor. The test covers the real forge.json, the real signer, each refusal and the served route. The only doc change is in OPERATING.md, not README. It is a machine-to-machine door, so having no terminal screen or how-to is reasonable. Not checked: whether production passes FORGE_APP_IDENTITY_KEY to this app, or counts its schedule in health, which can only be seen after merge. I only read the diff and did not curl the preview.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs