Repository navigation
fix(hooks): uptake credits a hint's use on a connection its session alone declared - #699
Merged
Merged
Conversation
…lone declared plumb stamps logical_agent only while several agents share a connection, so the consumed proxy, which joined on logical_agent alone, could never credit a Codex hint or one sent to a single-agent Claude Code session. The live Codex dogfood (PLAN-511) read the hinted file 17 s after a first-prompt hint and still counted as unattributed. InputsForAgent now also returns the unstamped calls of a connection whose every session_start declared this one session id, and that never recorded a stamped call. The declaration may follow the hint, which is the first-prompt case. Measured on the real stats.db: 39 ms for a 10-minute window, 72 ms for a week with no match, all on idx_tc_called_at, idx_tc_tool_dur and idx_tc_session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Plumb-Session: forest-ridge
…he recorder Review round 1 (independent Sonnet): - BLOCKING: the docs claimed an unstamped call is never credited to the wrong agent. An agent that never identifies itself leaves no trace on the connection, so its calls count as the declaring session's. Say "never observed shared" and state that limit in the code, the CHANGELOG, the reference docs and the --help text. - Pin the all-time scope: a stamped call, or a second declaration, after the window withdraws the connection (two new fixtures). - The e2e test records session_start through statsToolData, so redacting session_id there would fail it. - CROSS JOIN keeps win outer, so the plan probes idx_tc_session instead of scanning every session_start. - Drop two dead predicates. Note that namespaces are not told apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Plumb-Session: forest-ridge
Review round 2 NIT: the CROSS JOIN is the query's performance contract, and reverting it left every test green. EXPLAIN QUERY PLAN must show the session_start rows reached through idx_tc_session; with the old join form the test fails (SEARCH d USING INDEX idx_tc_tool_dur). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Plumb-Session: forest-ridge
golimpio
approved these changes
Oct 16, 2026
golimpio
left a comment
Contributor
There was a problem hiding this comment.
Independent review: round 1 FAIL (1 BLOCKING doc overclaim, 3 SHOULD), all fixed; round 2 PASS; its NIT folded in (plan pinned to idx_tc_session). Mutation: old query fails the new tests; 12/12 mutants killed incl. the reviewer's survivors and a session_id-redaction mutant. CI 9/9 green on head; make verify-full-container EXIT=0 on d426b08.
atlas-from-plumb
added a commit
that referenced
this pull request
Oct 16, 2026
Hooks stay inside their session's namespace (#698); context-hint uptake credits a hint's use on a connection its session alone declared (#699); the shared file watcher leaves linked git worktrees out (#700); an [lsp] restart can no longer land on a superseded config (#701). Plumb-Session: forest-ridge Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
plumb hooks uptake's consumed proxy joined a hint to later calls only throughtool_calls.logical_agent. plumb writes that column only while several agents share a connection, so every Codex hint, and every hint to a Claude Code session without subagents, read as unattributed. That includes the first-prompt hints that matter most. In the live Codex dogfood (PLAN-511), the agent read the hinted file 17 s after the hint, and the report still said "unattributed 1".Fix (
internal/stats/db_agent_inputs.go):InputsForAgentalso returns the unstamped calls of a connection that the session alone declared. That holds when everysession_starton the connection carries asession_id, all of them carry the same one, it is this session's, and the connection never recorded a stamped call. The declaration may follow the hint. Every rule fails closed.Evidence
session_startplus three reads ofplumb/internal/topology/indexer_calls.go. The query takes 39 ms for a 10-minute window and 72 ms for a week with no match, usingidx_tc_called_at,idx_tc_tool_durandidx_tc_session.session_start, shared, another session's, garbage JSON, and both window bounds;runHooksUptakeover both real stores, with an undeclared decoy as the control.InputsForAgenthad no tests before this.🤖 Generated with Claude Code