Skip to content

fix(capture): read the session id off the SessionStart hook payload#493

Open
boskodev790 wants to merge 1 commit into
vouchdev:testfrom
boskodev790:fix/finalize-all-session-id
Open

fix(capture): read the session id off the SessionStart hook payload#493
boskodev790 wants to merge 1 commit into
vouchdev:testfrom
boskodev790:fix/finalize-all-session-id

Conversation

@boskodev790

Copy link
Copy Markdown

What changed

vouch capture finalize-all now resolves the current session id from the SessionStart hook payload on stdin — the same wire capture finalize already reads at SessionEnd. --session-id and VOUCH_SESSION_ID are kept as fallbacks, in that order.

Why

fixes #492. the command resolved the id from --session-id or VOUCH_SESSION_ID only, but the shipped hook is bare vouch capture finalize-all || true and nothing in the adapter or runtime ever exports VOUCH_SESSION_IDgrep finds only the cli reader and two tests that set it themselves. so sid was always "" and the sweep returned {"finalized": [], ...} on every session start.

that left the #304 backstop dead in the shipped configuration: buffers orphaned by sessions that ended without SessionEnd accumulated in .vouch/captures/ and never rolled up into pending proposals, so those sessions never reached the review queue at all.

it went unnoticed because test_adapter_settings_wires_capture_hooks asserted observe / finalize / banner but never finalize-all, and every cli test for the command passed --session-id or the env var explicitly — the shipped path was the one path never exercised. that assertion is added here.

What might break

nothing on disk: no file moves, no field changes shape, no kb.* method behaves differently (capture finalize-all is CLI + SessionStart-hook only).

the behaviour change is the intended one: on an existing .vouch/, the first session start after upgrading will sweep any stale buffers that have been sitting in captures/ — each becomes one pending proposal, so a user with orphaned buffers may see several new items in vouch review. nothing is auto-approved and the review gate is untouched. the >1h age guard still protects the current session's buffer, and precedence is unchanged for anyone already passing --session-id explicitly.

a malformed or absent stdin payload still no-ops rather than raising, preserving the hook's never-fail-the-turn contract.

VEP

not a surface change — no kb.* method, object model, on-disk layout, bundle format or audit-log shape touched. no VEP.

Tests

  • make check passes locally (lint + mypy + pytest) — 1379 passed, 49 skipped; ruff clean; mypy clean across 98 source files

  • New / changed behaviour has a test

  • CHANGELOG.md updated under ## [Unreleased]

  • test_capture_finalize_all_cmd_reads_session_from_stdin — verified failing on test without the src change

  • test_capture_finalize_all_cmd_survives_malformed_stdin — pins the never-fail-the-turn contract

  • test_capture_finalize_all_cmd_flag_beats_stdin — pins precedence

  • test_adapter_settings_wires_capture_hooks now asserts the SessionStart finalize-all wiring

one thing i left alone deliberately: observe, finalize, ingest-codex --hook and this command now each parse a stdin payload their own way. consolidating them behind one helper seemed worth doing separately rather than inside a bug fix — happy to send that as a follow-up if you want it.

no ui surface touched, so no screenshots.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@plind-junior, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8bb57cf3-7bda-4202-8436-7c2fa56cdd02

📥 Commits

Reviewing files that changed from the base of the PR and between f168e25 and 7e2030a.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/vouch/cli.py
  • tests/test_capture.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance cli command line interface tests tests and fixtures size: S 50-199 changed non-doc lines labels Jul 15, 2026
finalize-all resolved the current session id from --session-id or
VOUCH_SESSION_ID only. the shipped SessionStart hook passes neither, and
nothing in the adapter or runtime exports VOUCH_SESSION_ID, so sid was
always "" and the sweep returned empty on every session start.

that made the vouchdev#304 backstop dead: buffers orphaned by sessions that ended
without SessionEnd accumulated in .vouch/captures/ and never rolled up
into pending proposals, so the session never reached the review queue.

the id now comes off the stdin payload the same way capture finalize
reads it at SessionEnd, with --session-id and VOUCH_SESSION_ID kept as
fallbacks. a malformed payload still no-ops rather than failing the
host's turn.

the adapter hook test asserted observe/finalize/banner but never
finalize-all, which is why the shipped wiring went unexercised; it now
covers it.
@boskodev790
boskodev790 force-pushed the fix/finalize-all-session-id branch from ead457d to 7e2030a Compare July 16, 2026 03:39
@plind-junior

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli command line interface docs documentation, specs, examples, and repo guidance size: S 50-199 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants