Repository navigation
feat(session-flow): replace the detached observer with a live-check mod and catch-up - #18976
Conversation
…od and catch-up The observer is now a hooks module plus a session-start catch-up. Live checks fork the main conversation (no tools, no transcript) on every 6th model step of a turn, and at turn end when observer_turn_end_check is on, and write at most one process fault per check to the running-retro ledger and a band row above the prompt. Repeats and disputed findings are suppressed, ignored findings back off, and each check's usage is recorded. The SessionStart hook now analyzes up to two ended sessions that got no live checks with the existing headless analysis, run once instead of a 24-hour tailer. The running-retro arm action and plugin-quality's arm entry are retired with it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22289042d1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ollow-ups A failed analysis (timeout, API or auth error, missing claude) now records state retained and failed_attempts in the status file. The next catch-up retries it once over the kept observations, at most two attempts per span; reading new bytes or a successful run resets the count. A min-lines skip is state skipped and is not retried. A ledger excludes a session from catch-up only when it has no status file. With a status file the stored offset decides, so the resumed follow-up of an analyzed session is analyzed. Declare the files the observer suites read (test-scope), which the Test Selection trace flagged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
After /clear or a resume no session.start fires, so a check now reads $.session.id() itself and writes its usage file and ledger under the current session, clearing a card left from the previous one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
claude-security-review reviewed Security review: incremental, e865850 → 6054cfa (#18976)I read every hunk of the 3 files in What I checked
Earlier findingsThe four UsageThe live step checks the changelog describes spend the user's session model usage (subscription or prepaid API usage). That is not a cost hold. critical-findings: 0 |
|
claude-review reviewed Code review (incremental, blocking only): live-check reply parser made linearBlocking only. This lane already reviewed an earlier head ( Scope. I read every hunk of all 3 files on the incremental list in Result: no blocking findings.
Verification. I ran nothing; this review read the code only. Spend (not a hold). Nothing new at this head. The spend from the last review is unchanged: forked live checks and catch-up analyses on the session's model usage when Loosened checks. Loosened checks would be marked: fail (bundled default; the prompt has no Closing issue. The PR context has no closing-issue section, so there are no acceptance criteria to check. Verifier dropped 0 of 0 candidates. |
The label regex allowed `**` as an alternative to `*`, so a long run of asterisks in a fork reply backtracked exponentially and could freeze the session. `[-*>\s]*` matches the same lines in linear time. The changelog now states that users who already enabled the observer get the live step checks on update. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Dispositions for the review-lane findings on 2228904:
|
Post-merge mutation testingKilled 4, survived 3, timeout 0, no coverage 0, invalid 0, not run 0.
Surviving mutants
The run's summary has the full report. |
Refs: #18959
Summary
The session-flow observer becomes a hooks module with live checks plus a session-start catch-up, and the detached 24-hour transcript tailer is retired in the same change (ADR 0052, one implementation per behavior). This leaves #18959 open for its last acceptance criterion: measuring the end-of-turn trigger's cost on one real working session before choosing its default.
Fix
plugins/session-flow/hooks/register.tsx, logic inobserver-live.ts): on the main thread, every 6th model step of a turn (observer_step_check, default on), and at the end of each tool-using turn whenobserver_turn_end_checkis on (default off until measured). A check is a$.model.forkwith only a prompt, so it has no tools and no transcript. It runs one at a time per session; a reply that arrives after the next turn started, or after the session ended, is dropped as stale. The prompt allows four categories (process, decision, verification, instruction), requires a cited rule, and defaults tofinding: none. A finding is redacted with$.session.redact, appended to the session's running-retro ledger, and shown as a band row:1Send to Claude ($.prompt.fill, append),2Noted,3Dispute,0Dismiss. Seen and disputed findings persist across sessions in$.storeand are suppressed. Findings typed past back off the next checks 1, 2, 4, 8, then 16. Each check's outcome and token usage is appended to<plugin data>/session-flow-observer/live-<session>.jsonl.hooks/observer-arm.shbecomeshooks/observer-catchup.sh. At an interactive start it launchesobserver.pyone-shot, detached, for up to 2 ended sibling sessions, newest first. A session qualifies when it has been idle at leastobserver_idle_seconds, changed within 3 days, has no live-check file, no ledger, and has grown past its stored offset.observer.pyno longer tails; it reads once from the stored offset, analyzes with the existing headless run, and exits.observer_poll_secondsandobserver_max_secondsare removed. Withobserver_analysis_enabledoff, no catch-up runs./session-flow:running-retro armand/plugin-quality:audit arm(nothing to arm).$.process.runfrom the module. The hook already has the self-trigger guards, the platform shim and the Python probe. A probe showed that either launcher outlives its session (Claude Code 2.1.332: asetsid -fchild of a mod's$.process.runin aclaude -p --plugin-dirrun kept running 41 s after exit).SESSION_FLOW_OBSERVER_ANALYSIS. Headless lanes get the catch-up.reference/observer.mdrewritten, README, setup and running-retro skills, plugin-quality session mode, options table and cheat sheet regenerated.engines["claude-code"]is>=2.1.331, the CI pin.Verification
claude plugin test plugins/session-flow: 18 pass. The tests cover the step trigger on steps 6 and 12 of the main thread only; no second check while one is in flight; stale replies dropped; the turn-end trigger off by default, on for tool-using turns, skipped on aborts; a ledger plus band finding, with Send filling the prompt; nothing filled without Send; cross-session dedup; Dispute; backoff; redaction; usage recording; and off unless enabled or in the analysis run.test_observer.py(pytest 9.2.0): 104 passed, 36 subtests. It covers one-shot analysis, no re-analysis past the stored offset, catch-up selection (the current session, too fresh, too old, a live marker, an existing ledger, already analyzed, the cap of 2), the lock, and every hook guard, including analysis off. The worker applied 18 single-line mutations and each failed the suite.validate-plugins.sh --only "session-flow plugin-quality": all manifests validated, all mod tests passed.Remaining
live-<session>.jsonl, and report them so the owner decides the end-of-turn default. This needs the released plugin in a real interactive session.Related
plugin_usagestamp until an in-session checkpoint runs./plugin-quality:audit sessionalready falls back to asking for one.🤖 Generated with Claude Code