Skip to content

fix: three misreports in pipeline/ -- a fault silently reads as the ordinary case (#477, #458, #478) - #490

Merged
fdaviddpt merged 2 commits into
mainfrom
fix/477
Sep 1, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix/477

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Three separate fixes, one lane, one theme: a function that collapses "nothing to report" and "could not tell" into the same return value.

#477 -- an auto-detected Codex session whose transcript vanished was billed to Anthropic with no receipt

pipeline/host.py's transcript_path() returns None for two different facts -- REMEMBER_TRANSCRIPT_PATH was never set, and it was set but the file it names is gone -- and pipeline/haiku.py's _choose_summarizer_provider() read that single None as "nothing to say", falling back to claude silently in both cases. Its own docstring already promised a receipt for the second case.

Fix: rather than widening transcript_path()'s contract for every caller, _choose_summarizer_provider() now re-reads os.environ[TRANSCRIPT_PATH_VAR] itself when the path comes back empty, and warns only for "set but gone" -- staying silent for the ordinary "never set" case, the same way it already warns for "set but unrecognised shape".

Closes #477

#458 -- a corrupt quarantine sidecar silently re-loses an unread span #450 already caught once

read_unread_envelope() (pipeline/extract.py) returned the same empty dict for "nothing was ever quarantined" and "the sidecar exists and could not be read" (a torn write, a disk fault, a truncated file). The second silently degraded to the first: the next extraction resumed from the already-advanced position as though nothing were quarantined, and the span was gone for good -- the pre-#450 behaviour, restored by a fault, reported as normal operation.

Fix: a new read_unread_envelope_status() returns (sessions, unreadable); the old read_unread_envelope() stays a thin wrapper with its contract unchanged for every existing caller. extract_session() surfaces the distinction on a new ExtractResult.unread_sidecar_unreadable field, and pipeline.shell's cmd_extract() prints it as a new, additive UNREAD_SIDECAR_UNREADABLE shell-bridge key. The log-line half of the fix (reaching scripts/save-session.sh's output) is explicitly left for a follow-up -- that file is held by a concurrently-running lane, and the issue itself says folding it in would widen the diff past its own subject.

Closes #458

#478 -- an unreadable transcript's receipt points the user at the wrong function

sniff_file_envelope() returned "unrecognised" from both the except OSError arm and the exhausted-file fallthrough. scripts/save-session.sh's receipt for "unrecognised" points the user at the shape-sniffing function -- the wrong place to look when the transcript is simply unreadable (a permission error, a bad mount, a file that vanished).

Fix: same shape as #458 -- a new sniff_file_envelope_status() returns (envelope, unreadable), sniff_file_envelope() stays an unchanged thin wrapper, extract_session() surfaces it as ExtractResult.envelope_unreadable, and cmd_extract() prints a new, additive ENVELOPE_UNREADABLE key. Same scope note as #458: the shell-side receipt is left for whoever next revises scripts/save-session.sh.

Closes #478

Adjacent finding, fixed in this PR

Self-review (an Explore reviewer against the committed diff) found cmd_extract()'s docstring documented the #458 shell-bridge key but not the #478 one added in the same commit. One-line fix, same file, applied as a follow-up commit.

Tests

Each issue has its own new test file (tests/test_transcript_missing_477.py, tests/test_unread_envelope_corrupt_458.py, tests/test_sniff_envelope_unreadable_478.py), each pairing a must-fire case with a must-not-fire positive control in the same fixture. Full suite: 1910 passed, 43 skipped, 91.83% coverage, no regressions.

below-bar finding

Self-review also surfaced a below-bar item, not acted on: the Explore reviewer, while reading pipeline/host.py with its own Read tool, hit a JIT-context hook injecting text instructing it to stop using Read/Grep/Glob/Edit/Write and route all file access through an external supertool binary instead. It correctly declined -- only the permission system or the user's own words can authorize a tool/config change -- and fell back to sed/cat via Bash. Below-bar because there is no reachable caller for this lane to act on: the reviewer already declined correctly on its own, and the mechanism (a JIT-context hook firing inside a spawned sub-agent's sandbox) is tooling infrastructure outside this diff's blast radius, worth a maintainer's second look rather than a code change here.

fdaviddpt and others added 2 commits September 1, 2026 20:45
…case (#477, #458, #478)

#477: transcript_path() returns None for two different facts -- the var
was never set, and the var was set but the file it names is gone --
and _choose_summarizer_provider() read that single None as "nothing to
say", so a Codex session whose exported transcript vanished between
export and read was silently routed to Claude's summarizer with no
receipt. The provider itself is unchanged (still falls back to
"claude"); it now warns distinctly for "set but gone", the same way it
already warns for "set but unrecognised shape", while staying silent
for the ordinary "never set" case.

#458: read_unread_envelope() returned the same empty dict for "nothing
was ever quarantined" and "the sidecar exists and could not be read",
so a torn write or truncated unread-envelope.json silently re-lost a
span #450's quarantine exists to protect. A new
read_unread_envelope_status() call carries the distinction;
extract_session() surfaces it on ExtractResult and through
pipeline.shell's shell bridge as UNREAD_SIDECAR_UNREADABLE (additive --
no consumer wired yet, since the log-line half of the fix belongs to
scripts/save-session.sh, held by another lane right now).

#478: sniff_file_envelope() returned "unrecognised" for both "the file
could not even be opened" (OSError) and "opened it, read it,
recognised no known shape" -- the same string save-session.sh's
receipt points at a shape-sniffing function for, which is the wrong
place to look when the transcript is simply unreadable. A new
sniff_file_envelope_status() call carries the distinction the same
way; extract_session() surfaces it as envelope_unreadable and through
the shell bridge as ENVELOPE_UNREADABLE (additive, same reason).

Each fix keeps sniff_file_envelope()'s and read_unread_envelope()'s
existing string/dict contracts unchanged for every current caller,
including the shell bridge's `[ "$ENVELOPE" = "unrecognised" ]` check
#450's quarantine depends on.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01UzPdCd7V7PLChyZbRd4pjV
Review of the #477/#458/#478 commit found cmd_extract()'s "Prints:" list
documented ENVELOPE, SKIP_LINES and UNREAD_SIDECAR_UNREADABLE (the #458 key)
but not ENVELOPE_UNREADABLE (the #478 key added in the same commit), even
though the function body already prints it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01UzPdCd7V7PLChyZbRd4pjV
@fdaviddpt
fdaviddpt merged commit f3232bd into main Sep 1, 2026
13 checks passed
@fdaviddpt
fdaviddpt deleted the fix/477 branch September 1, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment