Repository navigation
test(think): group A chat-recovery successors through public behaviour (resets, budgets, regeneration, platform cuts) - #3455
Merged
Conversation
|
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Contributor
|
✅ agents import sizes: no significant changes ( |
mattzcarey
force-pushed
the
slim/harness-A-successors-7
branch
from
November 27, 2026 10:34
005f4c7 to
7ca70c5
Compare
mattzcarey
force-pushed
the
slim/harness-A-successors-8
branch
from
November 27, 2026 10:34
ee59289 to
833448c
Compare
mattzcarey
force-pushed
the
slim/harness-A-successors-7
branch
from
November 27, 2026 10:44
7ca70c5 to
fc5197d
Compare
mattzcarey
force-pushed
the
slim/harness-A-successors-8
branch
from
November 27, 2026 10:44
833448c to
96ed1af
Compare
mattzcarey
changed the base branch from
slim/harness-A-successors-7
to
slim/harness-A-successors-2
November 27, 2026 10:52
This was referenced Nov 27, 2026
mattzcarey
force-pushed
the
slim/harness-A-successors-8
branch
from
November 27, 2026 10:53
96ed1af to
7e9e48c
Compare
mattzcarey
marked this pull request as ready for review
November 27, 2026 11:01
mattzcarey
force-pushed
the
slim/harness-A-successors-2
branch
from
November 27, 2026 11:34
30ad3ac to
3f218b2
Compare
mattzcarey
force-pushed
the
slim/harness-A-successors-8
branch
from
November 27, 2026 11:37
7e9e48c to
a7df108
Compare
mattzcarey
marked this pull request as draft
November 27, 2026 11:40
mattzcarey
force-pushed
the
slim/harness-A-successors-8
branch
from
November 27, 2026 11:43
a7df108 to
6e3a02a
Compare
mattzcarey
marked this pull request as ready for review
November 27, 2026 11:52
…x_attempts_exceeded and recovery_aborted through onExhausted
…ery only once the agent is idle
…nd persist: false after a real reset
…ry's attempt resets on progress, the give-up at maxAttempts + 1 does not
…rn seals with work_budget_exceeded
…eal resets, each after progress, go past maxAttempts and stop at maxInterruptedAttempts
…inished on its new branch, the earlier answer kept
…set while onChatRecovery runs re-runs it, with no terminal
… on the active branch, continue:false runs no model call, the interrupted-attempts bound is exact; the classifier tests are named in the rows
mattzcarey
force-pushed
the
slim/harness-A-successors-8
branch
from
November 27, 2026 12:04
6e3a02a to
5367af8
Compare
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.
Group A's chat-recovery successors after batch 2 (#3437), folded into one PR as Matt asked: one commit per change, each green alone. Stacked on #3437. Tests only, no changeset. The descriptions of the PRs folded in (#3443, #3445, #3449, #3452, #3454 and this one) follow, one section each.
On the harness config, each says which shell step makes it pass: most need A-4 (the turn definition's recovery budget),
persist: falseneeds A-5, and the rest pass now.test(think): public successors for onChatRecovery's continue/persist false after a reset (group A)
Group A's next batch of successors: what a turn a reset interrupted leaves behind when
onChatRecoverydeclines, through public behaviour on both configs. Theme (b) in harness's order. Stacked on #3437. Tests only, no changeset.Each test resets the isolate mid-reply with
ctx.abort, as an eviction does, usingresetDuringTurn, which now lives at file scope. The next start recovers the turn and asksonChatRecovery. The answer was stored with a new fixture,answerRecoveryForTest, in the agent's storage, so the isolate after the reset gives it. The test then waits until the agent is stable and reads the transcript.persist: falseis A-5)Class-only row (1): onChatRecovery › "{ continue: false } persists but does not schedule continuation". It builds its interrupted turn from seeded private stream rows and recovers it by hand. Its successor is the reset test above, which passes on both configs. "{ persist: false, continue: false } skips both" gets its row when its successor passes on the shell.
Batch 3 (progress resetting the budget) is held. On Think, what an app sees contradicts the promise: the attempt number resets on progress, but the give-up counts every interruption. The finding is with the deputy.
On the harness config: "continue: false" passes now; "persist: false, continue: false" passes with A-5.
On the harness config: "continue: false" passes now; "persist: false, continue: false" passes with A-5.
test(think): public successors for a stall's attempt count and give-up (group A)
Group A successors for "progress and the attempt budget", written to arch's ruling ("arch ruling (std A progress)"). Stacked on #3443. Tests only, no changeset.
Arch's ruling: one option drives two counts, on purpose.
max_attempts_exceededat stall numbermaxAttempts + 1, whatever the progress.attempt: the count that goes back to 1 when the last attempt made progress.armLastingStallForTestgains aprogressingoption: each model call writes new text, 30 chunks, so some land in the stream log before the stall.max_attempts_exceeded)Not written, and why:
CHAT_RECOVERY_ALARM_DEBOUNCE_MS(30 s) collapse into one attempt, so two quick stalls without progress both report attempt 1 (measured on the class). Nothing in the test config moves the agent's clock, and a fixed 30 s wait isn't allowed. So that clause of 4634 gets no successor. Its row will say "needs interruptions more than CHAT_RECOVERY_ALARM_DEBOUNCE_MS apart; drives beginIncident", for rv-6 to confirm.maxAttemptsup tomaxInterruptedAttempts: this needs several real resets in one test. It's next. If the pool can't drive that many, the row is mechanics-only ("drivesbeginIncident"), per arch.work_budget_exceeded, withmaxRecoveryWork: 2. It passes on the class.The class-only rows for 4634 and its siblings come when their successors pass on the shell.
On the harness config: all three (the attempt count with progress, the give-up at maxAttempts + 1, and the work budget) pass with A-4 (the turn definition's recovery budget).
On the harness config: all three (the attempt count with progress, the give-up at maxAttempts + 1, and the work budget) pass with A-4, the turn definition's recovery budget.
test(think): a public successor for the pre-stream retry after a real reset (group A)
Group A successors, theme (d), first part: a turn that a real reset cut off before its first chunk is answered again, with its user message once. Stacked on #3445. Tests only, no changeset.
The test resets the isolate while the model call is still waiting on the provider, before any stream (
resetDuringTurn(…, 0), withhangModelAtConnectForTest). The next start recovers the turn and retries it, and the test waits until the agent is stable. The transcript then holds the user message once and a non-empty assistant answer. It passes on both configs.Class-only row (1): onChatRecovery › "retries a pre-stream interrupted user turn by default without duplicating the user message". It builds the interrupted turn from a seeded private fiber and recovers it by hand. Its successor is the test above.
Still to do in (d): regeneration as a new branch (5443, 5499), which needs a socket regenerate before the reset, and the opened stream with no content (5632).
On the harness config: it passes now.
On the harness config: it passes now.
test(think): a public successor for the interrupted-attempts bound through real resets (group A)
A group A successor for the interrupted-attempts bound, through real resets, per arch's ruling ("arch ruling (std A progress)"). Stacked on #3449. Tests only, no changeset.
"recovers past maxAttempts across resets that each follow progress, until maxInterruptedAttempts": with
chatRecoveryset to{ maxAttempts: 1, maxInterruptedAttempts: 3 }:ctx.abort.maxAttempts, because each attempt made progress. Recovery then stops withchat:recovery:exhausted, reasoninterrupted_attempts_exceeded, a bound progress doesn't reset.It passes on the class, 2/2. On the shell it fails until A-4.
Fixtures:
keepAcrossResetsForTestkeeps a slow model andchatRecoveryin the agent's storage.ThinkTestAgent'schatRecoveryfield reads that storage when the agent is built, so recovery on the next start uses it.lastAssistantTextForTest.The pool can drive these resets, so this row needs no mechanics-only fallback. The class-only rows for 4634, 4765 and 4803 come once the shell passes their successors. The rows that name
beginIncident's debounce stay mechanics-only, as #3445 says.On the harness config: it passes with A-4 (the interrupted-attempts bound in the turn definition's budget).
On the harness config: with A-4 merged, it still fails on the shell: after the first reset, the recovered turn sends the new tab no text. Passed to harness.
test(think): a public successor for a regeneration a reset cut off (group A, #2028)
A group A successor for #2028, through a real reset: a regeneration that a reset cuts off is finished on its own new branch, and the earlier answer is kept. Theme (d). Stacked on #3452. Tests only, no changeset.
"finishes a regeneration a reset cut off on its new branch, keeping the earlier answer":
regenerate-messagefor the same user message, with a slow model. After two chunks, the isolate is reset withctx.abort.It passes on both configs.
Class-only row (1): onChatRecovery › "continues a regeneration interrupted after partial output on its new branch (#2028)". It builds the interrupted regeneration from seeded private stream rows and recovers it by hand. Its successor is the test above.
"retries a pre-stream interrupted regeneration as a new branch" (5443) needs the same reset, before the first chunk. It's next.
On the harness config: it passes now.
On the harness config: it passes now.
test(think): a public successor for a recovery the platform cut (group A)
A group A successor for "the recovery job was cut by the platform", as arch ruled ("arch ruling (std A platform error)"). Stacked on #3454. Tests only, no changeset.
"re-runs a recovery a reset cut while onChatRecovery ran, and sends no terminal":
resetDuringTurn).onChatRecovery, which the test holds on a gate (holdRecoveryOnceForTest; the agent's storage records that it's held and counts calls across resets).onChatRecoverycall. The agent goes stable with an answer, and there's nochat:recovery:exhaustedand no error frame.It passes on both configs.
Class-only rows (3), each injecting a platform reset into the class's private scheduled recovery callback, with this successor:
Probe-covered candidates (not marked here): "re-throws the SqlError shape (wrapped transient, retryable flag lost)" (#1730) and "re-throws a retryable-flagged platform error". Their fault is a platform error returned by a storage call, with no reset. They need verify's fault-suite scenario named per arch's third category, and the reviewer's confirmation. Verify is asked.
On the harness config: it passes now.
On the harness config: it passes now.
Included: #3437 test(think): public successors for the recovery budget's give-ups (group A, batch 2)
Group A's second batch of successors: when chat recovery gives up, and what
onExhaustedis told, through public behaviour on both configs. Theme (c), second in harness's order (A-4). Stacked on #3432. Tests only, no changeset.A new fixture,
armLastingStallForTest, stalls the next model streams and setschatRecovery(maxAttempts, anonExhaustedthat records, and optionallyshouldKeepRecovering) for as long as the agent lives. The test starts a turn and pollsrecoveryProgressForTestuntil recovery gives up. A'sstallRecoveryForTestcan't show a give-up: it returns after the first attempt, and it putschatRecoveryback before the attempts scheduled behind it run. Harness is told.The rows for the old tests they succeed come once these pass on the shell: 7052's "routes a stall through the same exhaustion path…", 4359's "exhausts chat recovery after the configured max attempts", and 4849's "seals when the shouldKeepRecovering predicate returns false". #3387's check needs a successor that passes there. "Progress resets the budget" (4634 and its siblings) needs a model that writes new text on each attempt, so it's the next batch.
rv-3's FIX (last commit): (a) the regeneration test asserts the text finished after the reset (the fresh isolate's answer) and that the regenerated branch is the active one; (b) continue:false asserts no model call ran after the reset; (c) the interrupted-attempts test asserts exactly 3 resets (two recovered past maxAttempts 1, the third ends it); (d) the three platform-cut rows name the
retries.test.tsclassifier tests.