Skip to content

E2E docs follow SDD; a Resume at the instant of finish is no longer refused as busy - #1529

Merged
brillout merged 2 commits into
mainfrom
claude/backend-e2e-mock-tests-t7ci4f
Aug 10, 2026
Merged

E2E docs follow SDD; a Resume at the instant of finish is no longer refused as busy#1529
brillout merged 2 commits into
mainfrom
claude/backend-e2e-mock-tests-t7ci4f

Conversation

@brillout

@brillout brillout commented Aug 10, 2026

Copy link
Copy Markdown
Member

What

Two things, the second surfaced by this PR's own CI run:

  1. Fixes the SDD violation from Add backend E2E story tests: dashboard user stories over a fake agent #1527/Close the two finished-session races the E2E stories surfaced #1528: per sdd.md, spec.md files cover business logic only and explicitly exclude test code — and they're plain-language product docs, while src/e2e/spec.md was technical harness documentation.
  2. Fixes the third finished-session race, which this PR's first CI run flaked on: the settings story's Resume-at-done was refused as "already active" on a slow runner.

SDD conformance (e73f6a77)

  • src/e2e/spec.mdsrc/e2e/README.md — the content is genuinely useful developer documentation, so it lives on as a README, where technical detail belongs and sdd.md doesn't govern. The five source-comment references follow the rename.
  • The two product behaviors Close the two finished-session races the E2E stories surfaced #1528 shipped now live in the specs that own them, phrased as business logic: acting-at-finish is safe (packages/the-framework/spec.md, teardown) and a live watcher never misses a session's ending (src/dashboard-rpc/spec.md).

The Resume-at-finish refusal (5957d36b)

CI failed settings written in the dashboard reach the next resumed run (#858/#1467): sendStart({continueRunId}) returned busy. A run's row flips done the moment the child writes its ending, but the child takes a beat more to actually exit — and a Resume landing in that gap found the run's slot still holding a live pid, so the busy guard turned away a continuation of a session that was over by its own account. #1528's run lock made acting-at-finish safe; this window could still make it fail.

Fix in daemon-runtime:

  • Each leg's exit → retirement chain (markFailedStarttearDownWorktree → transient retry) is parked per run slot in a retiring map.
  • Before the busy guard, a continuation of a run whose meta reads terminal waits out the exit and the queued retirement, bounded (15s). The status probe uses findRun — the composed read where the live copy wins — because the just-written done isn't in the archive until teardown puts it there.
  • A run still calling itself running is a genuine collision and keeps its refusal, and a leg that never exits within the grace still reaches the guard.

Validation: waitOutFinishedLeg has six deterministic unit tests; the settings story went from 5/15 red under standalone stress to 15/15 green, the other three story files 4/4 each, and the full package suite passes 1719 tests. Changeset (patch) included for the behavior fix.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XKihCTfcazhDgt4dhUmfM9

claude added 2 commits August 10, 2026 15:58
sdd.md scopes spec.md files to business logic and explicitly excludes
test code, and specs are plain-language product docs — the e2e spec.md
was both misplaced and written as technical harness documentation.

- src/e2e/spec.md becomes src/e2e/README.md (developer doc, where
  telefunction names, env vars, and file references belong); the five
  source-comment references follow the rename.
- The two product behaviors #1528 shipped move to the specs that own
  them, in spec language: acting on a session the instant it finishes
  is safe (product spec, teardown) and a live stream follows the log
  into the archive without dropping the ending (dashboard-rpc spec).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XKihCTfcazhDgt4dhUmfM9
The settings story flaked on CI (#1529): sendStart with continueRunId hit
the busy guard while the finished first leg's child was still mid-exit —
the slot held a live pid, and the continuation of a session that was over
by its own account was refused as "already active".

daemon-runtime now parks each leg's exit → retirement chain per run slot
(retiring), and a continuation of a run whose meta reads terminal (via
findRun — the live copy wins, since the just-written `done` is not
archived until teardown) waits out the exit and the queued retirement,
bounded, before the guard judges. A refusal is reserved for sessions
genuinely still running, and the checkout reuse always reads a settled
archive. waitOutFinishedLeg carries six unit tests; the settings story
pins the full path (15× stress green, from 5/15 red).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XKihCTfcazhDgt4dhUmfM9
@brillout brillout changed the title Follow SDD: the E2E test dir gets a README, not a spec.md E2E docs follow SDD; a Resume at the instant of finish is no longer refused as busy Aug 10, 2026
@brillout
brillout merged commit 4f3eead into main Aug 10, 2026
1 check passed
@brillout
brillout deleted the claude/backend-e2e-mock-tests-t7ci4f branch August 10, 2026 16:28
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.

2 participants