test(runbooks): fork-session context-fate probe#1013
Merged
michael-wojcik merged 3 commits intoJun 22, 2026
Merged
Conversation
Pure predicate: a session is restarted when the live stdin session_id differs from the persisted-context session_id, with both present and valid. Structural discriminator only -- never keys on leadSessionId == session_id (true in both in-process and tmux modes). Lands as a sibling to detect_stale_session_block rather than a shared accessor: the two read different sources (the live context SSOT vs the CLAUDE.md Resume line) that can legitimately disagree after a restart, so they remain independent.
A disposable, operator-safe probe that empirically settles whether --fork-session leaves a stale session_id field at the new-id context path. It does not: session_init writes a fresh live-id context on the fork. The detector keys on OLD session_start events copied into the new journal -- robust to session_init overwriting the context field, since --fork-session inherits the lead agent_type. Includes a format-guarded cleanup that aborts unless the disposable temp-slug is set, and a non-vacuity control (a simulated dir-copy must trip the detector). Records the measured CASE 1 (FRESH) verdict in the run-dates log.
…ion leaf" This reverts commit a194f1a.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the disposable
--fork-sessioncontext-fate probe runbook — the empirical instrument that settled the Resume/Restart/Persistence reliability cluster's central question and refuted the planned durable fix's premise.What landed
tests/runbooks/994-fork-session-context-fate.md— a SAFE, self-runnable probe measuring whether--fork-sessionleaves a stalesession_idfield at the new-id context path. Verdict: CASE 1 (FRESH) —session_initwrites a fresh live-id context on fork; no stale field. Includes a journal-artifact (masking-proof) detector, a non-vacuity control, and a hard-guarded disposable cleanup (format-checked temp-slug, protected-token guard).tests/runbooks/RUNBOOK_RUN_DATES.md— records the CASE 1 run.is_session_restartedpredicate added earlier on this branch — it has no consumer (the probe refuted the case-3 premise the durable fix was built on), so it is dead code. Net diff vs main is runbook-only.Why
The probe's CASE-1 verdict empirically refuted the "stale session_id field on restart" (case-3) mechanism the planned durable #994 reconciliation had inferred — so that durable fix has no scenario and stands down. Re-diagnosis under the corrected premise confirmed the cluster is already cured at HEAD:
session_initre-persists a non-empty name every SessionStart; confirmed by a disposable resume-repro); empty-SSOT fail-closed guard correct & unchanged.Cluster shipped-value was PR #1010 (the cheap-win self-diagnosis, already merged); this PR preserves the reusable probe instrument.
No version bump —
tests/runbooks/dev tooling only; the canonical 4 version files are untouched.