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

A reach alarm is not raised for a child the host just restarted, and clears when it answers #14032

opened this

Merged 16d 21h ago, live in production

A child the host stopped or restarted in the last few minutes no longer raises a reach alarm on its first failed proof. The reach tests and the 8 test files that import spawn/reach pass, and tsc is clean. I did not run the full suite or bun scripts/fast.ts's file list: it named 2036 files, too broad to run here.

Notes

opened this

A child the host stopped or restarted in the last few minutes no longer raises a reach alarm on its first failed proof. The reach tests and the 8 test files that import spawn/reach pass, and tsc is clean. I did not run the full suite or bun scripts/fast.ts's file list: it named 2036 files, too broad to run here.

What changed (src/spawn/reach.ts)

  • New restartedRecently(app, child) checks three things within the settle window (SETTLE_MS, or the settleMs option): a stop the host noted (lastStop), the on-disk stopped.json mark, and the startedAt in the child's cell.json. An adopted cell keeps its original start time in its record, so a freshly adopted cell counts only if it was recently started, not merely recently adopted.
  • sweepReach now calls record(app, proved, !restartedRecently(...)). A failure in that window is kept (ok: false, alarmed: false) but raises no forge.child_unreachable and no flow alarm. The next sweep alarms if the child is still failing and the window has passed.
  • Clearing on the first ok proof already worked and is unchanged.

Tests (test/spawn-reach.test.ts)

  • A recent stop, and separately a recent cell.json start, keep the failure with no alarm and no event.
  • Past the window the same failure alarms once, and an ok proof clears it.
  • Stage-rig proof: a sweep is held mid-check, cancelRestarts is called on the parent as a release would, and the check still finishes and keeps its proof. I took "a release" to mean that call, since the issue doesn't define it; that is the one place to check against what you meant.

Not done

  • settleChild, firstProof and the new-child path are unchanged.
  • No new dependencies.

Try it Run bun test test/spawn-reach.test.ts.

Closes #13757

3 earlier comments
commented

A child the host stopped or restarted in the last few minutes no longer raises a reach alarm on its first failed proof. The reach tests and the 8 test files that import spawn/reach pass, and tsc is clean. I did not run the full suite or bun scripts/fast.ts's file list: it named 2036 files, too broad to run here.

What changed (src/spawn/reach.ts)

  • New restartedRecently(app, child) checks three things within the settle window (SETTLE_MS, or the settleMs option): a stop the host noted (lastStop), the on-disk stopped.json mark, and the startedAt in the child's cell.json. An adopted cell keeps its original start time in its record, so a freshly adopted cell counts only if it was recently started, not merely recently adopted.
  • sweepReach now calls record(app, proved, !restartedRecently(...)). A failure in that window is kept (ok: false, alarmed: false) but raises no forge.child_unreachable and no flow alarm. The next sweep alarms if the child is still failing and the window has passed.
  • Clearing on the first ok proof already worked and is unchanged.

Tests (test/spawn-reach.test.ts)

  • A recent stop, and separately a recent cell.json start, keep the failure with no alarm and no event.
  • Past the window the same failure alarms once, and an ok proof clears it.
  • Stage-rig proof: a sweep is held mid-check, cancelRestarts is called on the parent as a release would, and the check still finishes and keeps its proof. I took "a release" to mean that call, since the issue doesn't define it; that is the one place to check against what you meant.

Not done

  • settleChild, firstProof and the new-child path are unchanged.
  • No new dependencies.

Try it Run bun test test/spawn-reach.test.ts.

commented

The gate failure is fixed in a new commit and pushed. The forge's check hasn't run on it yet, so I don't know that it passes.

The gate rejected the Bun.sleep(10) at test/spawn-reach.test.ts:216, which gives the sweep time to reach the held fetch before the test cancels the restarts. I kept the sleep and ended that line with // real-timer: and the reason. No clock is injected in that code path, so there was nothing to step.

Run locally, bun x tsc --noEmit is clean and test/spawn-reach.test.ts passes (13 tests). My local gate.ts run still named line 216 after the edit. That rule only reads lines a pull adds, so it was judging my uncommitted change against the old commit; the real answer comes from the forge's check on this push.

commented

A reach alarm is now held back for a child the host just stopped or restarted. It still alarms once the settle window passes, and clears when the child answers. This push addresses the review. Locally test/spawn-reach.test.ts passes (16 tests), and tsc and the gate are clean. The forge's check hasn't run on it yet.

  • Release test: deleted, as you suggested. It passed with or without this change. The Bun.sleep(10) and the held-fetch scaffolding went with it, so no timer is left in the file.
  • Split tests: the one test with three scenarios is now four, each failing on its own: a noted stop, a cell started a minute ago, and the window past (alarms once, then clears on an ok proof). I added a fifth: a healthy child just restarted proves ok.
  • stoppedMark alone: I added this case now rather than after approval. It writes only the stop mark, checks lastStop is undefined, and expects the failure kept without an alarm.
  • Failure-only check: you were right to ask. The call site read the two files on every proof, ok or not. It now runs restartedRecently only on a failed proof (proved.ok || !restartedRecently(...) in src/spawn/reach.ts). The result for an ok proof is the same, because record ignores the alarm flag then.
  • Not tested: that the files are read only on failure. Nothing observable separates it from the old behaviour, so I left it unasserted rather than add a spy.
commented

The four failures are timing flakes on a loaded runner, not from my change. The same tests pass here, and the check log says the scaffold test is green on main. My change only touches src/spawn/reach.ts and test/spawn-reach.test.ts. I have changed nothing and pushed nothing new.

  • Scaffold test: the "inside its 3 s budget" test took 4.4 s on the runner, which was also running the full 15,847-test suite across shards. Here the same test took 2.2 s against the 3 s budget and passed.
  • Engine test: "sees every event after its cursor" in test/engine-split.test.ts timed out at 4.4 s on the runner. Here it passes, though the run logged slow-SQL warnings of up to about 1 s.
  • ETag tests: two ETag tests in shard 29 failed in about 1 ms each. They pass here too. Without the runner's log I can't say why they failed there.

I ran test/etag.test.ts, test/engine-split.test.ts and test/scaffold.test.ts locally: 28 pass, 0 fail. The right next step is to re-run the check on the current head, 157b5cf99. If any of those four fails again on its own, that points at something other than load.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs