Skip to content

T-129: retry TTSR-aborted turns with a rule-specific continuation prompt - #134

Merged
jaesbit merged 1 commit into
develfrom
auto-work/t129-detect-ttsr-session-retry
Jul 25, 2026
Merged

T-129: retry TTSR-aborted turns with a rule-specific continuation prompt#134
jaesbit merged 1 commit into
develfrom
auto-work/t129-detect-ttsr-session-retry

Conversation

@jaesbit

@jaesbit jaesbit commented Jul 25, 2026

Copy link
Copy Markdown
Owner

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

  • waitForAutoWorkSessionTerminalResult now accumulates rule names from any ttsr_injection event ({ type: "ttsr_injection", injectedRules: string[] }) seen before the real terminal event, and surfaces them as AutoWorkTerminalResult.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.
  • Retry budget (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 simulating ttsr_injectionaborted and asserting the continuation prompt names the rule).
  • bun x tsc --noEmit -p apps/server — no new errors (pre-existing failures in session-monitor.ts/session-monitor.test.ts and an unrelated this typing issue in engine.test.ts:806 predate this change).

Closes T-129.

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.
@jaesbit
jaesbit merged commit 943ad66 into devel Jul 25, 2026
@jaesbit
jaesbit deleted the auto-work/t129-detect-ttsr-session-retry branch July 25, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant