Repository navigation
Conversation
## Human comments ## What was wrong Claude Code emits a command start before requesting permission. The timeline kept that timestamp after approval, so a command that ran instantly could show a duration of several minutes spent waiting for the user. ## What changed Treat a successful command approval resolution as the execution start. Clear the waiting state and carry the new start time through running and completed rows while preserving the original sequence. Update an ongoing command's existing history row when another tool appeared during approval. Keep reused call IDs as separate executions after completion. Add a timeline regression for Allow once and session approval, including an interleaved command and the displayed duration label. ## How you verified - Confirmed the regression failed before the fix with the original start time and waiting state. - `pnpm exec turbo run test typecheck lint --filter=@bb/thread-view` passed: 450 tests and typecheck. This package has no lint task. - `pnpm exec turbo run typecheck lint --filter=@bb/thread-view --filter=@bb/app` passed; app lint reported existing warnings and no errors. - Direct Oxlint passed for all changed files. The full thread-view scan reports four pre-existing no-comments errors in user-message-parsing.ts, confirmed against HEAD. - Rendered the real projection and timeline components in a temporary apps/app Ladle story served through Turbo. Reviewed before/after screenshots at 1280x800 and 390x844, saved with the fixture in thread storage. The inflated 2m 24s label disappears for a 100ms execution. iOS Safari was not tested. - `git diff --check` passed. > AGENT GENERATED
## What was wrong The server route test expected a successfully approved command to retain its waiting-for-approval state, conflicting with the corrected timeline lifecycle. ## What changed Expect the approved pending command's approvalStatus to be null. ## How you verified - All 25 public thread interaction route tests passed through Turbo. - Server typecheck passed through Turbo; this package has no lint task. - Direct Oxlint passed for the changed test file. - git diff --check passed. > AGENT GENERATED
ymichael
deleted the
bb/exclude-approval-wait-from-command-durations-thr_gf3mtytbw6
branch
October 7, 2026 18:04
ymichael
pushed a commit
that referenced
this pull request
Oct 8, 2026
## Human comments ## What was wrong When the main agent sends a follow-up to a Codex sub-agent that has finished, the Codex translator reopened the sub-agent's original delegation item: the same id, in the turn that first spawned it. The timeline projection only merges a start event into an existing row while that call is still running, so each reopen added another row with the same id (`onExecBegin` in `tool-activity-projection.ts`). Children attach to a delegation by call id, so every copy rendered the sub-agent's entire history. When a sub-agent also followed up its own sub-agents, the copies multiplied at every level. That is the exponential growth in #5210 that exhausted the server heap. Even without nesting, threads showed one delegation many times; one local thread rendered a sub-agent 14 times, with 2,609 timeline rows instead of 982. ## What changed - **`plugins/provider-codex/src/translator.ts`:** a follow-up to a finished sub-agent starts a new delegation. Its id is the follow-up interaction's own id, it is placed in the parent turn that sent the follow-up, and it uses the same path as a newly spawned sub-agent. Each round now appears in the turn where it happened and contains only that round's work. Follow-ups queued while the sub-agent is still running stay in the current round. Nested follow-ups attach to the parent's current round. - **`packages/thread-view/src/tool-activity-projection.ts`:** a start event for a finished delegation reopens its existing row instead of adding a copy. This fixes threads already stored with reused ids: they show one row per sub-agent, holding every round. Commands keep #5108's behaviour, where a reused call id gets its own row. - **`packages/thread-view/src/normalize-event-projection.ts`** (from the original version of this PR): each delegation keeps one child per message id. This is a backstop against exponential growth if duplicate ids arrive from another source. - **Dropped from the original version:** the incremental byte budget in `timeline-pagination.ts`. The oversized tree is fully built before pagination serializes it, so that change didn't address the crash. - No wire, schema, CLI, or plugin API changes. ## How you verified - New `delegation-item-projection` test: a delegation reopened by a follow-up, with a nested sub-agent that is also reopened, renders one row per delegation with all child messages. It runs in two variants, the last round completing or still running. It fails on `main` and passes with the projection change alone. - Codex translator tests: a follow-up from a later parent turn opens a new delegation in that turn, and the sub-agent's next turn links to it. A new nested test checks that a sub-agent's follow-up to its own sub-agent attaches to the parent's current round. Six tests fail on the old translator. - Replayed a stored Codex thread's 6,124 events through the projection: the reopened delegations went from 14 and 6 copies to 1 each; timeline rows fell from 2,609 to 982 and JSON from 14.6 MB to 3.9 MB. - Ran real Codex end to end in a worktree dev instance: spawning a sub-agent in turn 1 and following it up in turn 3 produced separate `/root/counter` rows in turns 1 and 3, containing only "ONE" and only "TWO". - `pnpm exec turbo run test typecheck lint --filter='...[origin/main]'`: 38 tasks passed. Fixes #5210 > AGENT GENERATED --------- Co-authored-by: qa <qa@x> Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Human comments
What was wrong
Claude Code emits a command start before asking for permission. The timeline kept that timestamp after the user approved, so an instant command could show minutes spent waiting for Allow once as execution time.
What changed
Use successful command approval resolution as the execution start, clear the waiting state, and carry the updated timestamp through running and completed rows. Preserve the original row and sequence when another tool appears during approval. Completed executions that reuse a call ID remain separate.
Add a regression for Allow once and session approval, including an interleaved command and the displayed duration label. Update the server API test to expect the waiting state to clear after successful approval. No wire or public API changes.
How you verified
pnpm exec turbo run test typecheck lint --filter=@bb/thread-view: 450 tests and typecheck passed. The package has no lint task.pnpm exec turbo run typecheck lint --filter=@bb/thread-view --filter=@bb/app: passed; app lint reports existing warnings and no errors.user-message-parsing.ts, confirmed against HEAD.pnpm exec turbo run test --filter=@bb/server -- test/public/public-thread-interactions.test.ts: all 25 tests passed. Server typecheck passed through Turbo, and direct Oxlint passed for the changed test file.git diff --check: passed.