Consolidate duplicated kill-ring and timeout-race modules (CL-6790) - #608
Merged
TheGreatAxios merged 1 commit intoAug 24, 2026
Conversation
TheGreatAxios
enabled auto-merge (squash)
August 24, 2026 06:48
TheGreatAxios
force-pushed
the
cl-6790-consolidate-duplicated-modules-two-kill-rings-two-repetition
branch
from
August 24, 2026 06:50
e2ce1ca to
5cc63ae
Compare
- Delete the dead Ink-era kill ring (src/tui/kill-ring.ts + test); the OpenTUI prompt-kill-ring.ts is the sole implementation. - Extract shared timeout-race primitives (src/util/budget-race.ts) used by shell-guard's search budget and the tool-execution watchdog, replacing two copies of the same AbortController+setTimeout race and BUDGET_EXPIRED sentinel; both now reference the shared timeout-prefix string constant instead of a hardcoded literal. - runtime-bridge.ts re-exports mapReactorLike from stream-event-map.ts instead of wrapping it in an identical local function.
TheGreatAxios
force-pushed
the
cl-6790-consolidate-duplicated-modules-two-kill-rings-two-repetition
branch
from
August 24, 2026 08:13
5cc63ae to
8b2b221
Compare
TheGreatAxios
added a commit
that referenced
this pull request
Aug 27, 2026
) - Delete the dead Ink-era kill ring (src/tui/kill-ring.ts + test); the OpenTUI prompt-kill-ring.ts is the sole implementation. - Extract shared timeout-race primitives (src/util/budget-race.ts) used by shell-guard's search budget and the tool-execution watchdog, replacing two copies of the same AbortController+setTimeout race and BUDGET_EXPIRED sentinel; both now reference the shared timeout-prefix string constant instead of a hardcoded literal. - runtime-bridge.ts re-exports mapReactorLike from stream-event-map.ts instead of wrapping it in an identical local function.
TheGreatAxios
added a commit
that referenced
this pull request
Aug 27, 2026
) - Delete the dead Ink-era kill ring (src/tui/kill-ring.ts + test); the OpenTUI prompt-kill-ring.ts is the sole implementation. - Extract shared timeout-race primitives (src/util/budget-race.ts) used by shell-guard's search budget and the tool-execution watchdog, replacing two copies of the same AbortController+setTimeout race and BUDGET_EXPIRED sentinel; both now reference the shared timeout-prefix string constant instead of a hardcoded literal. - runtime-bridge.ts re-exports mapReactorLike from stream-event-map.ts instead of wrapping it in an identical local function.
TheGreatAxios
deleted the
cl-6790-consolidate-duplicated-modules-two-kill-rings-two-repetition
branch
August 28, 2026 00:09
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.
Summary
CL-6790 dedup pass. Net line delta (excluding tests/docs): -119 lines (60 insertions, 179 deletions across non-test files).
Consolidated
src/tui/kill-ring.ts(the Ink-era copy) and its test. It had zero production callers;src/tui/prompt-kill-ring.ts(used byshell.ts) is the sole, more complete implementation (it also has thekilledTextForward/killedTextBackwarddiff helpers the deleted copy lacked).buildAuthorizeUrl/baseTokensFromResponse/exchangeCode/refreshTokenRequestfrom the genericsrc/auth/oauth/client.tsand only add provider-specific mapping. No changes needed.src/provider/reasoning-effort.tsre-exports the constant fromsrc/agent/profile-types.ts. No changes needed.runtime-bridge.tsnow re-exportsmapReactorLikefromstream-event-map.tsdirectly instead of wrapping it in an identical local function.src/util/budget-race.ts(BUDGET_EXPIRED,budgetExpiry,withTimeout), consumed by bothsrc/plugins/shell-guard-plugin.tsandsrc/tui/tool-execution-watchdog.ts, replacing two independent copies of the sameAbortController+setTimeoutrace. Both now reference the sharedTIMEOUT_PREFIXconstant (exported fromtool-time-budget.ts) instead of a hardcoded"[timed out before completing]"string.Stopped / not touched
atomicWrite(mkdir + temp file + rename) is already shared:src/workflows/state.tsimports it fromsrc/session/state.ts. The surrounding write-chaining wrapper genuinely differs in behavior between the two: session state's chain is keyed bysessionId, gates writes onisCrashed(), and deletes its map entry once the chain drains; workflow state's chain is keyed by path, has no crash gate, and never evicts entries (relying onflushWorkflowStateWritesfor explicit awaiting). Forcing these into one helper would either add a crash gate to workflow writes or drop cleanup from session writes — both are behavior changes, so left as-is per the "stop and report" instruction.detectRepetition(two copies) — explicitly out of scope per the ticket; a sibling lane (CL-6995) is removing repetition detection entirely. Not touched (src/subagent/repetition.ts,src/util/period-detection.ts, TUI stall watchdog repetition code all untouched).Follow-up (not done in this pass)
Test plan
bun testruns across all touched modules pass.bun run check(lint + typecheck + build + full test suite) passes: 5444 pass, 0 fail.vendor/.