CL-7802: start gated tool elapsed at grant, not announcement - #1176
Open
TheGreatAxios wants to merge 5 commits into
Open
TheGreatAxios wants to merge 5 commits into
TheGreatAxios wants to merge 5 commits into
Conversation
Allow-once settles exactly once and frees the single-slot overlay host, so an already-queued or newly raised card paints before any deferred slash/settings/MCP surface. Command surfaces suspend and return after the gate settles; inline popups keep their stacking contracts.
gateOpened snapshotted every timed call into the rebase set, so an auto-allowed sibling that was already executing reset to 0:00 when a later gate settled. Skip ids that already carry a live elapsed clock.
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.
Rebases gate-waited tool clocks to the grant so post-grant stats read time-since-grant.
Grant signal (read-only finding): the bridge has no per-call execution-start event and the product-host gate wiring reports only a single settle per gate (
gate-wireonceClosed, fired for allow and deny alike). SogateClosedis the rebase point, scoped to calls tracked as gate-waited. No product-host or gate-wire changes.What changes (
src/tui/runtime-bridge.ts):BridgeBag.gatedToolCallsset: populated from the timed-call snapshot ingateOpenedplusapplyToolCallarrivals whileblockedGateCount > 0.gateClosedcalls newrebaseGatedElapsed: waited ids gettoolCallStartedAt = now()and a painted0:00viarowUpdates.scheduleRowUpdate. Later ticks flow through the existingsyncToolElapsedpath, so post-grant cadence is identical to ungated rows.gateClosedfires for deny too, and the result merge already drops the clock-owned stat for the answer's own addendum (omitStat).spawn_agentids are skipped (session clock owns those rows); diff rows never enter the set. Ids are dropped inapplyToolResultandrollbackAttempt(no leaks).shell.inFlightTool.startedAtdeliberately untouched: its only reader (resolveWaitingOn) uses it as a steer-wait threshold, not an execution clock.Open questions / call-outs:
Verification:
2:00leftover instead of0:00).bun test src/tui/runtime-bridge.test.ts src/tui/allow-once-reprompt.test.ts src/tui/agent-progress.test.ts src/tui/turn-state.test.ts— 150 pass, 0 fail.bun run typecheckexit 0;bun run lintexit 0.bun test ./src ./tests ./evals ./scripts --randomize --seed 424242: 8040 pass, 1 fail — the single failure isbackground shell registry > collect with an aborted signal releases as running without killing the child, a load-sensitive timing flake insrc/shell(zero imports fromsrc/tui); it passes 3/3 standalone and flaps with the fix applied, so it is unrelated to this change.Fixes CL-7802