Skip to content

Stop Command details from re-parsing every historical Session trace - #1377

Merged
JacobStephens2 merged 10 commits into
mainfrom
issue-1363
Oct 26, 2026
Merged

JacobStephens2 merged 10 commits into
mainfrom
issue-1363

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Command details stop reparsing unrelated historical Session traces. Historical signals are reused across Console requests and separate CLI processes while the source is unchanged.

show / Console /peek
  capture all Command records for Usual ranges and health
  enrich selected Command + child Ticket runs + dispatches
metrics
  enrich every Command
Session signals
  unchanged trace + same binary -> reuse derived summary
  append / replacement / binary change -> parse and cache again
Console details request
  after 10 seconds -> "Details unavailable. Reload to try again."

A bounded memory cache and disposable *.signals-cache.json files retain derived signals by the resolved Session trace's identity. Per-trace locks coordinate readers; atomic replacement publishes complete cache files. Unchanged malformed traces retain the same Missing result until repaired. Stored completion signals take precedence, and historical Command records are never rewritten. The branch also reconciles current main while preserving its mailbox and folded details.

Evidence

  • Before: two consecutive release-build metrics --json processes took 36.181s and 31.913s, each opening the same 562 Session traces / 4.31 GB. The cache survived only within one process.
    After: the first load populated the cache (45.065s with strace); the next process opened zero Session traces (1.119s with strace). Without tracing overhead, cached metrics took 0.241s. Measured with strace -f -e trace=openat -o <capture> target/release/thirdshift metrics --json, capturing JSON privately and counting trace opens.
  • Before: cargo test --test metrics unchanged_session_signals_survive_between_cli_processes -- --exact --nocapture failed because a second CLI process reopened an unchanged trace (left: 1, right: 0).
    After: it passes, including JSON equality, append invalidation, same-length/same-mtime replacement invalidation, reuse by show, and unchanged historical Command records.
  • Before: the Spec review's exact malformed-trace reproduction failed with second load reparsed unchanged malformed historical trace.
    After: that command passes, and cargo test --test metrics unchanged_malformed_session_signals_are_not_reparsed_and_repair_refreshes_them -- --exact passes while also checking repair invalidation.
  • On the original logs directory (1,752 JSONL files / 8.60 GB), cached show --json took 0.095–0.104s for all four reported Commands; their Console /peek requests took 0.072–0.121s, all HTTP 200.
  • The four Snapshot regression tests cover 562 historical Commands, nested dispatches/children, unchanged-trace reuse, append/replacement invalidation, stored signals, and unchanged Usual ranges and health.
  • node --test console/tests/inbox.test.cjs: 46 passed, including the held-request timeout and reopening the pane. cargo clippy --all-targets -- -D warnings and cargo fmt --check passed.
  • /usr/bin/time -p scripts/affected-tests main at 88b61cd0: 3,113 Rust tests passed, 69 helper tests ignored; 50 site tests passed, exit 0, 1510.20s including compilation. The subsequent CI-only fixture change passed all 16 skill tests (1 helper ignored); production code is identical.
  • CI exposed an existing partial-output fixture race at 88b61cd0: a fake harness exited without consuming stdin, so prompt writing sometimes returned Broken pipe before the incomplete-turn assertion. The fixture now drains its prompt before emitting its partial event. Assertions and production behavior are unchanged. The prior full run and 20 isolated repeats passed locally; the CI failure is recorded here.

Seams

  • stop::inspect / Snapshot::load_details and show: selected Command signals, nested work, and all-Command health/Usual ranges.
  • Snapshot::load_metrics and separate metrics --json CLI processes: signal reuse, source invalidation, Missing results and saved completion metrics.
  • Console loadPeek: bounded waiting and recovery after a held request.

Unaddressed findings

Standards: None.

Spec: None.

Security: None.

Both review findings were addressed: exact selection uses CommandIdentity, and unchanged malformed traces retain Missing. The final Standards and Spec reviews each read all 16 changed files, including the CI fixture correction. No changed file was left unread; there were no generated-output exclusions.

Security review outcome

No unaddressed introduced findings.

Merge Danger

Door: two-way

Historical records and Session traces remain unchanged. Derived cache files are disposable; cache-write failures fall back to parsing. The first metrics load after a binary change still parses historical traces to populate its cache.

Blast Radius: narrow

Command details, thirdshift show, and thirdshift metrics; ordinary status reads do not load historical Session signals.

Closes #1363

Built with codex codex-cli 0.164.0 · gpt-6.1-sol · xhigh

…apacity. Please try a different model.)

2026-10-26T09:00:54Z, host thirdshift. Uncommitted work at the time of failure is included in this commit.
…apacity. Please try a different model.)

2026-10-26T13:14:37Z, host thirdshift. Uncommitted work at the time of failure is included in this commit.
Command details still read only that Command and its nested work. The record cache no longer takes a byte-size closure, and the site names Session traces.
…ed or not reproduced completion line)

2026-10-26T14:40:09Z, host thirdshift. Uncommitted work at the time of failure is included in this commit.
@JacobStephens2
JacobStephens2 marked this pull request as ready for review October 26, 2026 21:02
@JacobStephens2
JacobStephens2 merged commit 5935122 into main Oct 26, 2026
18 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-1363 branch October 26, 2026 21:14
@JacobStephens2 JacobStephens2 mentioned this pull request Oct 26, 2026
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.

Command details take ~35s because every read re-parses historical Session traces

1 participant