Skip to content

fix(deploy): a standing request keeps its ORIGINAL timestamp — elapsed_ms was the tick period, and my #4190 grace compared against it - #4191

Merged
joelteply merged 1 commit into
canaryfrom
c48fc453/deploy-stranded-s-elapsed-ms-is-the-tick
Sep 20, 2026
Merged

joelteply merged 1 commit into
canaryfrom
c48fc453/deploy-stranded-s-elapsed-ms-is-the-tick

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Every deploy.stranded this node has ever recorded, across three separate deploys:

09-18 07:41:39   elapsed_ms = 300014
09-18 08:56:39   elapsed_ms = 300004
09-18 11:46:07   elapsed_ms = 299882
tick interval, from 75 consecutive deploy.track.* rows: 300 s

Three deploys, three values within 132 ms of each other, all equal to the tick. That
number was never the age of the request. It was the cadence wearing a duration's name.

Why: on a Deploy verdict, tick() called
write_deploy_request(&DeployRequest::new(tip, now)) unconditionally — re-stamping
requested_ms every tick for the same tip. And in the STRANDED state decide() returns
Deploy on EVERY tick (tip readable, core answering, tip != running, no hold, no build in
flight, checks green, tree clean — every guard passes). So reconcile_request always read a
request stamped exactly one tick ago. Observed directly: request_written fired at
11:41:07, 11:46:07 and 11:51:07 for the same tip, and the file read requested_ms=11:51:04.

The DeployRequest doc comment promised the fix and the code never had it: "Keyed by
tip_sha so re-recording the same tip is idempotent (the module does not re-emit an
identical pending request every tick)."

What it cost, and the part that is mine:
before #4190 Stranded fired one tick after the request, always, reporting a constant
dressed as a duration — misleading, but it fired.
after #4190 I added STRANDED_GRACE_MS = 20 min and compared elapsed_ms against it.
300 s is never 20 min, so deploy.stranded became UNREACHABLE. I turned a
misleading probe into a dead one. The grace was right in intent and wrong
in what it was measured against.
also deploy.settled's waited_ms measured from the LAST re-stamp: this node's
12:43:58 settle reported 3,171,068 ms (52.9 min) for a request first
written at 11:41 — off by the ten minutes of re-stamps.

The class is [[the-metric-is-wrong-for-the-decision]]: the gate ran, emitted, and decided
correctly against a number invariant under the thing being decided. I had the evidence
in hand: my own #4190 message says "elapsed_ms=300004 is exactly one tick after the
request" — I SAW the coincidence and filed it as eagerness instead of asking why it could
never be anything else. A third sample was already in the ledger and I never looked.

The fix is the promised idempotence, as a pure function so it is assertable with no
filesystem: request_to_persist(existing, tip, now) returns None for an unchanged tip
(leave the original stamp alone — it is the only record of how long this has been owed)
and a fresh request only for a changed one. The module writes, and probes, only when it
returns Some. Now elapsed_ms is an age, the grace means what it says, Stranded fires at 20
minutes on a genuinely stranded deploy, waited_ms is honest, and the per-tick
request_written repeat is gone.

Receipt:
cargo test -p continuum-core --lib --features metal,accelerate -j 2
-- deploy_tracker deploy_claim
16 passed; 0 failed; 8293 filtered out; REAL_EXIT=0
lib test: 75 warnings, none naming either file

New test a_standing_request_keeps_its_original_timestamp_so_elapsed_is_an_age: two ticks
of an unchanged tip persist nothing, and — the assertion that fails against the old
behaviour — a request standing past STRANDED_GRACE_MS with nothing building IS Stranded.
Under re-stamping, elapsed_ms could never exceed one tick and that arm was unreachable.

Card: c48fc453-7dfb-451e-ac48-0b0ffc364624

Co-Authored-By: Claude Opus 5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…d_ms was the tick period, and my #4190 grace compared against it

Every deploy.stranded this node has ever recorded, across three separate deploys:

    09-18 07:41:39   elapsed_ms = 300014
    09-18 08:56:39   elapsed_ms = 300004
    09-18 11:46:07   elapsed_ms = 299882
    tick interval, from 75 consecutive deploy.track.* rows: 300 s

Three deploys, three values within 132 ms of each other, all equal to the tick. That
number was never the age of the request. It was the cadence wearing a duration's name.

Why: on a Deploy verdict, tick() called
`write_deploy_request(&DeployRequest::new(tip, now))` unconditionally — re-stamping
requested_ms every tick for the same tip. And in the STRANDED state decide() returns
Deploy on EVERY tick (tip readable, core answering, tip != running, no hold, no build in
flight, checks green, tree clean — every guard passes). So reconcile_request always read a
request stamped exactly one tick ago. Observed directly: request_written fired at
11:41:07, 11:46:07 and 11:51:07 for the same tip, and the file read requested_ms=11:51:04.

The DeployRequest doc comment promised the fix and the code never had it: "Keyed by
tip_sha so re-recording the same tip is idempotent (the module does not re-emit an
identical pending request every tick)."

What it cost, and the part that is mine:
  before #4190  Stranded fired one tick after the request, always, reporting a constant
                dressed as a duration — misleading, but it fired.
  after #4190   I added STRANDED_GRACE_MS = 20 min and compared elapsed_ms against it.
                300 s is never 20 min, so deploy.stranded became UNREACHABLE. I turned a
                misleading probe into a dead one. The grace was right in intent and wrong
                in what it was measured against.
  also          deploy.settled's waited_ms measured from the LAST re-stamp: this node's
                12:43:58 settle reported 3,171,068 ms (52.9 min) for a request first
                written at 11:41 — off by the ten minutes of re-stamps.

The class is [[the-metric-is-wrong-for-the-decision]]: the gate ran, emitted, and decided
correctly against a number invariant under the thing being decided. I had the evidence
in hand: my own #4190 message says "elapsed_ms=300004 is exactly one tick after the
request" — I SAW the coincidence and filed it as eagerness instead of asking why it could
never be anything else. A third sample was already in the ledger and I never looked.

The fix is the promised idempotence, as a pure function so it is assertable with no
filesystem: `request_to_persist(existing, tip, now)` returns None for an unchanged tip
(leave the original stamp alone — it is the only record of how long this has been owed)
and a fresh request only for a changed one. The module writes, and probes, only when it
returns Some. Now elapsed_ms is an age, the grace means what it says, Stranded fires at 20
minutes on a genuinely stranded deploy, waited_ms is honest, and the per-tick
request_written repeat is gone.

Receipt:
    cargo test -p continuum-core --lib --features metal,accelerate -j 2 \
      -- deploy_tracker deploy_claim
    16 passed; 0 failed; 8293 filtered out; REAL_EXIT=0
    lib test: 75 warnings, none naming either file

New test `a_standing_request_keeps_its_original_timestamp_so_elapsed_is_an_age`: two ticks
of an unchanged tip persist nothing, and — the assertion that fails against the old
behaviour — a request standing past STRANDED_GRACE_MS with nothing building IS Stranded.
Under re-stamping, elapsed_ms could never exceed one tick and that arm was unreachable.

Card: c48fc453-7dfb-451e-ac48-0b0ffc364624

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply force-pushed the c48fc453/deploy-stranded-s-elapsed-ms-is-the-tick branch from affb200 to 77a0c02 Compare September 20, 2026 21:13
@joelteply
joelteply enabled auto-merge (squash) September 20, 2026 21:36
@joelteply
joelteply merged commit b7a0ca1 into canary Sep 20, 2026
6 checks passed
@joelteply
joelteply deleted the c48fc453/deploy-stranded-s-elapsed-ms-is-the-tick branch September 20, 2026 21:36
joelteply added a commit that referenced this pull request Sep 20, 2026
Resolutions:
- `modules/deploy_tracker.rs`: canary's `request_to_persist` (#4191, the fix that
  stopped re-stamping a standing request every tick and pinning `elapsed_ms` at the
  tick period) is kept as the write rule. The actuator then acts on the request that
  STANDS for this tip — freshly written or owed since an earlier tick — because it
  bounds its own attempts and a retry must be judged against the original ask, not a
  re-stamped one. This branch's `request_for_tip` is deleted as superseded, and its
  test with it: canary already pins the same law in the right place
  (`runtime::deploy_tracker::a_standing_request_keeps_its_original_timestamp_so_elapsed_is_an_age`).
- `docs/architecture/RTOS-DEBUGGER-PROBES.md`: both probe sections kept — the deploy
  actuator's and the workspace transfer's.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant