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

The forge calls an absorbed app's scheduled tool on time, once, and remembers how it went #9962

Parked opened this
Closed without merging

The forge now calls each absorbed app's declared scheduled tools when they come due, and keeps the last fire of each. I ran tsc --noEmit and four test files, and they are green. Those were test/feature-schedule-fire.test.ts, test/feature-schedule.test.ts, test/pull-check-again.test.ts and test/apps-features.test.ts.

Notes

stopped parked by the crew deploy 3e8f30e

opened this

The forge now calls each absorbed app's declared scheduled tools when they come due, and keeps the last fire of each. I ran tsc --noEmit and four test files, and they are green. Those were test/feature-schedule-fire.test.ts, test/feature-schedule.test.ts, test/pull-check-again.test.ts and test/apps-features.test.ts. I did not run the whole suite; the forge's check does that on the push. I did not start the app, so the timer has not run against a live app.

What changed

  • src/apps/feature_schedule.ts
    • due(entry, lastFired, now) is pure: an entry is due if it never fired, or its interval has passed since the last fire.
    • fireDue(app, now, deps?) goes through each absorbed app whose production state is running and calls each due tool through callTool, the same loopback call the features tool uses (POST /forge/tools/<name>, 64 KB, 10 s). There is no new HTTP path.
    • Asleep, stopped and un-absorbed apps are never called, and an asleep app is not woken. A tool already in flight is not called a second time.
    • startFeatureSchedule(app) ticks every minute and is unref'd.
  • Migration 20261109050000-feature-fire.ts: table app_feature_fire, one row per (app, tool), holding the time, ok or the error's sentence, and the duration. The migration pin is committed.
  • src/http/server.ts: the tick starts beside the other writers and is stopped in the server's stop(). It does not start when NODE_ENV=test, which bun test sets, so no timer runs under the test harness unless a test calls startFeatureSchedule. That addresses the #9892/#9916 risk.
  • test/feature-schedule-fire.test.ts: covers due vs not due, once per window and again in the next, a failing tool recorded with its sentence, an asleep app skipped, and an un-absorbed app not called. It uses an injected clock and injected deps, so it never waits on wall time.

Not done

  • Nothing reads the recorded fires yet: no page, no MCP output. The issue asked only for them to be kept.
  • A fire that was due while the forge was down fires once on the next tick, not once per missed window.
  • I did not call keep_plan; that tool is not available in this session.

To try it: absorb an app whose forge.json declares "schedule": [{ "tool": "scan", "every": "15m" }], run the forge, and look at the app_feature_fire row after a minute.

🤖 Generated with Claude Code

Closes #9926

3 earlier comments
commented

The forge now calls each absorbed app's declared scheduled tools when they come due, and keeps the last fire of each. I ran tsc --noEmit and four test files, and they are green. Those were test/feature-schedule-fire.test.ts, test/feature-schedule.test.ts, test/pull-check-again.test.ts and test/apps-features.test.ts. I did not run the whole suite; the forge's check does that on the push. I did not start the app, so the timer has not run against a live app.

What changed

  • src/apps/feature_schedule.ts
    • due(entry, lastFired, now) is pure: an entry is due if it never fired, or its interval has passed since the last fire.
    • fireDue(app, now, deps?) goes through each absorbed app whose production state is running and calls each due tool through callTool, the same loopback call the features tool uses (POST /forge/tools/<name>, 64 KB, 10 s). There is no new HTTP path.
    • Asleep, stopped and un-absorbed apps are never called, and an asleep app is not woken. A tool already in flight is not called a second time.
    • startFeatureSchedule(app) ticks every minute and is unref'd.
  • Migration 20261109050000-feature-fire.ts: table app_feature_fire, one row per (app, tool), holding the time, ok or the error's sentence, and the duration. The migration pin is committed.
  • src/http/server.ts: the tick starts beside the other writers and is stopped in the server's stop(). It does not start when NODE_ENV=test, which bun test sets, so no timer runs under the test harness unless a test calls startFeatureSchedule. That addresses the #9892/#9916 risk.
  • test/feature-schedule-fire.test.ts: covers due vs not due, once per window and again in the next, a failing tool recorded with its sentence, an asleep app skipped, and an un-absorbed app not called. It uses an injected clock and injected deps, so it never waits on wall time.

Not done

  • Nothing reads the recorded fires yet: no page, no MCP output. The issue asked only for them to be kept.
  • A fire that was due while the forge was down fires once on the next tick, not once per missed window.
  • I did not call keep_plan; that tool is not available in this session.

To try it: absorb an app whose forge.json declares "schedule": [{ "tool": "scan", "every": "15m" }], run the forge, and look at the app_feature_fire row after a minute.

🤖 Generated with Claude Code

commented

No fix was needed, and I pushed nothing: the preview of #9962 is running and the pull's check is green.

  • Preview: the deploy log ends done: https://lab--9962--forge-trevato-apps.open-platform.sh, with "forge is up" after it. / answers 200 in about 0.9 s.
  • Check: the pull reports check: green, it isn't stale, and it's mergeable. The head is still c1e7b24, the commit I pushed.
  • The log line: "no tests declared, none run" only says forge.json names no test command for the preview deploy. It isn't a failure.

I can't tell from here why you were told it failed. If a different log shows an error, send me that part and I'll look at it.

commented

The forge now calls an absorbed app's scheduled tool when it is due, once per due time, and records how each call went. The earlier check failed only because no commit message had a "Try:" line, and src/http/server.ts is in this pull.

I added an empty commit with that line and pushed it. bun scripts/gate.ts passes locally. I did not rerun tsc or the tests, because the new commit changes no code.

What changed

  • src/apps/feature_schedule.ts fires an absorbed app's scheduled tool when it is due.
  • A new migration, src/core/migrations/20261109050000-feature-fire.ts, adds the table that records each firing and its outcome.
  • src/http/server.ts has a four-line change that wires the scheduler in.
  • test/feature-schedule-fire.test.ts covers firing on time, firing once, and recording the outcome.

What I chose not to do

  • I left the earlier commits as they were. Amending would have needed a force push, which is refused.

How to try it

  • Open the preview at / and check it boots.
  • The recorded outcomes are in the feature_fire table.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs