T-129: retry TTSR-aborted turns with a rule-specific continuation prompt - #134
Merged
Merged
Conversation
waitForAutoWorkSessionTerminalResult now accumulates injectedRules from ttsr_injection events seen before the terminal event, and settleAutoWorkRun's same-run abort retry names the violated rules in the continuation prompt instead of sending a generic 'try again'. Falls back to the generic prompt when no rules were captured. Retry budget and failure routing (T-100) unchanged.
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.
Problem
When TTSR aborts an auto-work turn,
settleAutoWorkRun's same-run retry sent a generic continuation prompt (T-100/T-96 same-run abort retry). It didn't name the rule that fired, so the agent could easily repeat the same pattern and trigger TTSR again on the retry.Change
waitForAutoWorkSessionTerminalResultnow accumulates rule names from anyttsr_injectionevent ({ type: "ttsr_injection", injectedRules: string[] }) seen before the real terminal event, and surfaces them asAutoWorkTerminalResult.injectedRules.settleAutoWorkRun's same-run abort retry builds a targeted continuation prompt naming the violated rule(s) when present, falling back to the previous generic prompt otherwise.MAX_SAME_RUN_ABORT_RETRIES = 1) and post-failure task routing (T-100) are unchanged — a second TTSR-triggered abort in the same run still fails the run.Testing
bun test src/auto-work/engine.test.ts— 183 pass, 0 fail (added a new same-run-abort-retry test simulatingttsr_injection→abortedand asserting the continuation prompt names the rule).bun x tsc --noEmit -p apps/server— no new errors (pre-existing failures insession-monitor.ts/session-monitor.test.tsand an unrelatedthistyping issue inengine.test.ts:806predate this change).Closes T-129.