Skip to content

feat(capture): make realtime observe opt-in (default off) - #645

Merged
plind-junior merged 5 commits into
vouchdev:testfrom
kurosawareiji7007-hub:feat/capture-realtime-opt-in
Jul 31, 2026
Merged

feat(capture): make realtime observe opt-in (default off)#645
plind-junior merged 5 commits into
vouchdev:testfrom
kurosawareiji7007-hub:feat/capture-realtime-opt-in

Conversation

@kurosawareiji7007-hub

@kurosawareiji7007-hub kurosawareiji7007-hub commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add capture.realtime (default false): capture observe no-ops with {skipped: realtime-disabled} instead of spawning a store write on every tool call.
  • Drop Claude Code adapter PostToolUse / Stop hooks; SessionStart/UserPromptSubmit/SessionEnd remain.
  • Rebuild observations from the transcript at finalize so min_observations still works without the realtime buffer; realtime: true restores the old buffer path.
  • Host-neutral rebuild: try Claude parser then Codex (same as load_transcript), including Codex tool mapping via _observation_from_call.
  • CLI checks enabled: false before realtime so a fully-disabled kb stays silent.
  • Installer prunes vouch-owned PostToolUse/Stop observe/answer hooks on reinstall so upgrades drop per-tool spawns.
  • Note: rebuild inherits parser max_messages=2000; very long sessions may lose oldest tool calls vs uncapped realtime buffer.
  • Test stub rewrites (sh→python) are intentional Windows-compat drive-bys alongside yaml config injection.

Fixes #602

Test plan

  • pytest tests/test_capture.py tests/test_session_split.py tests/test_adopt.py tests/test_capture_answer.py tests/test_session_transcript.py tests/test_install_adapter.py
  • Codex transcript rebuild case in test_observations_from_transcript_rebuilds_codex_tool_activity
  • Silent when enabled: false even with realtime: false
  • Installer upgrade prunes old PostToolUse/Stop vouch hooks
  • Confirm starter config ships realtime: false
  • With default config, vouch capture observe emits skip JSON and does not write a buffer
  • Finalize with a transcript still files a session summary when activity clears min_observations
  • capture.realtime: true restores PostToolUse-style buffer observe

@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance cli command line interface adapters agent host adapters and install manifests storage kb storage, migrations, schemas, and proposals tests tests and fixtures size: M 200-499 changed non-doc lines labels Jul 30, 2026
@plind-junior

Copy link
Copy Markdown
Member

@kurosawareiji7007-hub Check the CI failing issues

kurosawareiji7007-hub added a commit to kurosawareiji7007-hub/vouch that referenced this pull request Jul 30, 2026
CI lint failed on vouchdev#645 after the realtime opt-in test edits.
@kurosawareiji7007-hub
kurosawareiji7007-hub force-pushed the feat/capture-realtime-opt-in branch from fb9b2f6 to 48f6f8d Compare July 30, 2026 15:56
kurosawareiji7007-hub added a commit to kurosawareiji7007-hub/vouch that referenced this pull request Jul 30, 2026
CI lint failed on vouchdev#645 after the realtime opt-in test edits.
kurosawareiji7007-hub added a commit to kurosawareiji7007-hub/vouch that referenced this pull request Jul 30, 2026
Exercise observations_from_transcript parse/error/skip branches and
capture observe CLI paths for realtime-disabled, capture-disabled, and
no-store so the vouchdev#645 diff-coverage gate hits 100%.
@kurosawareiji7007-hub
kurosawareiji7007-hub force-pushed the feat/capture-realtime-opt-in branch from 48f6f8d to 6a26e16 Compare July 30, 2026 18:11
@github-actions github-actions Bot added size: L 500-999 changed non-doc lines and removed size: M 200-499 changed non-doc lines labels Jul 30, 2026
@plind-junior

Copy link
Copy Markdown
Member

thanks — this lands all four items of #602's suggested shape: the capture.realtime knob defaulting off, the early no-op with {"skipped": "realtime-disabled"}, dropping both PostToolUse and Stop from the shipped template, and rebuilding observations from the transcript so the min_observations gate stays meaningful. the leftover-buffer fallbacks in session_split.summarize and the regression coverage are exactly right.

one change is needed before merge. observations_from_transcript (src/vouch/capture.py) imports parse_claude_transcript directly, but the default flips for every host. a codex session that passes its transcript to finalize rebuilds zero observations, falls back to an empty buffer, and any session touching fewer than min_observations files silently stops producing summaries — the exact failure the issue's compat section flagged, now on non-claude hosts. please update the rebuild to reuse the format detection already in transcript.load_transcript (try the claude parser, fall back to parse_codex_transcript) instead of hardcoding the claude one, and add a codex-transcript case to test_observations_from_transcript_rebuilds_tool_activity.

two smaller updates worth making in the same pass. in capture_observe_cmd (src/vouch/cli.py), swap the order of the two config checks so enabled: false stays silent regardless of realtime — right now a fully-disabled kb prints the skip json where it used to print nothing, and the existing silent-when-disabled test only covers enabled: false, realtime: true. and in the settings merge, prune vouch-owned PostToolUse/Stop entries (match on vouch capture observe / vouch capture answer) so re-running the installer actually removes the per-tool spawns for existing installs; the current assert "PostToolUse" not in merged["hooks"] in tests/test_install_adapter.py passes trivially because the fixture never had the old hooks, so please add that upgrade case too.

two optional notes, no change required: the rebuild inherits the parser's max_messages=2000 default, so very long sessions lose their tail tool calls where the buffer had no cap — worth a higher cap or a comment acknowledging the bound. and the sh→python stub rewrites in the test files are windows-compat drive-bys; the yaml conversions are justified by the config injection, just call the rest out in the pr body so reviewers know they're intentional.

happy to re-review once the host-neutral rebuild is in — everything else here is in good shape.

@plind-junior
plind-junior enabled auto-merge July 30, 2026 19:14
@plind-junior
plind-junior disabled auto-merge July 30, 2026 19:14
@plind-junior
plind-junior enabled auto-merge July 30, 2026 19:30
@plind-junior
plind-junior disabled auto-merge July 30, 2026 20:00

@plind-junior plind-junior left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the comment above

Fixes vouchdev#602: capture.realtime defaults false; observe no-ops; Claude
adapter drops PostToolUse/Stop; finalize rebuilds observations from
transcript so min_observations still works.
CI lint failed on vouchdev#645 after the realtime opt-in test edits.
Exercise observations_from_transcript parse/error/skip branches and
capture observe CLI paths for realtime-disabled, capture-disabled, and
no-store so the vouchdev#645 diff-coverage gate hits 100%.
@kurosawareiji7007-hub
kurosawareiji7007-hub force-pushed the feat/capture-realtime-opt-in branch from 6a26e16 to 4858d0a Compare July 31, 2026 02:31
Reuse Claude-then-Codex transcript detection for observations_from_transcript,
check enabled before realtime skip JSON, and prune retired PostToolUse/Stop
hooks on adapter reinstall so upgrades drop per-tool spawns.
@kurosawareiji7007-hub

Copy link
Copy Markdown
Contributor Author

Addressed the review items on 312df0c:

  1. Host-neutral rebuildobservations_from_transcript now tries Claude then Codex (same detection as load_transcript), maps Codex tools via _observation_from_call (unwraps the parser's arguments/input wrapper), and adds a Codex case to the rebuild tests.
  2. CLI orderenabled: false returns silently before the realtime skip JSON; covered by test_observe_cli_silent_when_disabled_even_if_realtime_off.
  3. Install prune_merge_settings prunes vouch-owned PostToolUse/Stop hooks matching vouch capture observe / vouch capture answer; upgrade case in test_settings_json_merge_prunes_retired_observe_hooks.

Also noted the max_messages=2000 bound in the rebuild docstring and called out the Windows test stub rewrites in the PR body.

Hit the remaining diff-coverage gaps on non-dict parse results, Codex
failed-command rewrite, and prune_retired malformed/untouched groups.
@kurosawareiji7007-hub

Copy link
Copy Markdown
Contributor Author

CI is green on 35d74bc (including the 100% diff-coverage gate). Review items from the earlier pass are in; ready for re-review when you have a moment.

@plind-junior
plind-junior enabled auto-merge July 31, 2026 06:05

@plind-junior plind-junior left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@plind-junior
plind-junior disabled auto-merge July 31, 2026 06:30
@plind-junior
plind-junior merged commit cbc228d into vouchdev:test Jul 31, 2026
16 checks passed
galuis116 added a commit to galuis116/vouch that referenced this pull request Jul 31, 2026
a6c6862 (vouchdev#686) fixed capture.load_config's min_observations and
dedup_window_seconds to fall back to their defaults on a malformed
config value via the new coerce_numeric() helper, instead of raising
ValueError straight out of load_config. 47eaf56 (vouchdev#645, realtime
opt-in) branched off the pre-fix capture.py and reintroduced the bare
int()/float() calls when it merged into test - the coerce_numeric
import survived (nothing else referenced it), but the two call sites
it fed didn't, silently reverting the fix and leaving
test_load_config_malformed_numeric_falls_back red on `test` HEAD
itself, currently failing this PR's CI via ruff's unused-import gate.

restore the coerce_numeric() calls, matching recall.load_config's
still-intact equivalent.

unrelated to this PR's own change (fsck delete-proposal handling);
needed only to get CI green on top of a currently-broken `test`.
philluiz2323 added a commit to philluiz2323/vouch that referenced this pull request Jul 31, 2026
a6c6862 (vouchdev#686) fixed capture.load_config's min_observations and
dedup_window_seconds to fall back to their defaults on a malformed
config value via the coerce_numeric() helper, instead of raising
ValueError straight out of load_config. 47eaf56 (vouchdev#645, realtime
opt-in) branched off the pre-fix capture.py and reintroduced the bare
int()/float() calls when it merged into test - the coerce_numeric
import survived (nothing else referenced it), but the two call sites
it fed didn't, silently reverting the fix and breaking ruff's
unused-import gate for every PR built on top of `test`.

restore the coerce_numeric() calls, matching recall.load_config's
still-intact equivalent.

unrelated to this PR's own change (extract.py segmentation); needed
only to get CI green on top of a currently-broken `test`.
joaovictor91123 added a commit to joaovictor91123/vouch that referenced this pull request Jul 31, 2026
a6c6862 (vouchdev#686) fixed capture.load_config's min_observations and
dedup_window_seconds to fall back to their defaults on a malformed
config value via the coerce_numeric() helper, instead of raising
ValueError straight out of load_config. 47eaf56 (vouchdev#645, realtime
opt-in) branched off the pre-fix capture.py and reintroduced the bare
int()/float() calls when it merged into test - the coerce_numeric
import survived (nothing else referenced it), but the two call sites
it fed didn't, silently reverting the fix and breaking ruff's
unused-import gate for every PR built on top of `test`.

restore the coerce_numeric() calls, matching recall.load_config's
still-intact equivalent.

unrelated to this PR's own change (graph.py edge leak); needed only
to get CI green on top of a currently-broken `test`.
joaovictor91123 added a commit to joaovictor91123/vouch that referenced this pull request Jul 31, 2026
a6c6862 (vouchdev#686) fixed capture.load_config's min_observations and
dedup_window_seconds to fall back to their defaults on a malformed
config value via the coerce_numeric() helper, instead of raising
ValueError straight out of load_config. 47eaf56 (vouchdev#645, realtime
opt-in) branched off the pre-fix capture.py and reintroduced the bare
int()/float() calls when it merged into test - the coerce_numeric
import survived (nothing else referenced it), but the two call sites
it fed didn't, silently reverting the fix and breaking ruff's
unused-import gate for every PR built on top of `test`.

restore the coerce_numeric() calls, matching recall.load_config's
still-intact equivalent.

unrelated to this PR's own change (experts.py viewer scoping); needed
only to get CI green on top of a currently-broken `test`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adapters agent host adapters and install manifests cli command line interface docs documentation, specs, examples, and repo guidance size: L 500-999 changed non-doc lines storage kb storage, migrations, schemas, and proposals tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make real-time capture opt-in: default capture.realtime off, drop PostToolUse observe from adapters

2 participants