Skip to content

fix(loop): reject fast-exit detached runs; sync turn-counter docs - #477

Merged
huichen merged 1 commit into
mainfrom
fix/detach-liveness-and-turn-doc
Sep 3, 2026
Merged

huichen merged 1 commit into
mainfrom
fix/detach-liveness-and-turn-doc

Conversation

@huichen

@huichen huichen commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two follow-ups to the detached-run (#473) and turn-provenance (#474) fixes.

1. Detached-run liveness check

spawn succeeding only means the child process was created, not that it
re-dispatched correctly. A mis-dispatched re-exec (e.g. the child drops the
loop group and lands on the unrelated one-shot future run, which rejects
--goal) exits instantly with a usage error — while the parent printed a fake
pid and returned success, leaving the orchestrator to discover a dead worker
later.

This change gives the child a short grace window (120 ms), then try_waits
it: if the child has already exited, cmd_run bails with a pointer to the
detached log instead of reporting a fake pid.

2. Doc sync for the turn counter

The goal-level monotonic turn counter (base_turn + global_turn) landed in
#474, but DecisionSummary::turn and record_turn_decision still described
the old run-local counter. Updated both doc comments to the goal-level
semantics.

Tests

  • cargo check -p future-loop ✅
  • cargo test -p future-loop --lib quota::decision_summary ✅ (2 passed)
  • cargo test -p future-loop --test quota_read_model_contract ✅ (8 passed)

Two follow-ups to the detached-run and turn-provenance fixes:

1. Detached-run liveness check. `spawn` succeeding only means the child was
   created, not that it re-dispatched correctly. A mis-dispatched re-exec
   (e.g. the child drops a group layer and lands on an unrelated command)
   exits instantly with a usage error while the parent printed a fake pid and
   returned success. Give the child a short grace window, then bail with a
   pointer to the detached log when it has already exited.

2. Doc sync. The goal-level monotonic turn counter landed in #474 but the
   `DecisionSummary::turn` field and `record_turn_decision` docs still
   described the old run-local counter. Update both to the goal-level
   semantics.
@huichen
huichen merged commit 68c5955 into main Sep 3, 2026
12 checks passed
@huichen
huichen deleted the fix/detach-liveness-and-turn-doc branch September 3, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant