Skip to content

fix(agents): compact mid-turn overflow while code-mode work is still pending - #129792

Merged
VACInc merged 10 commits into
mainfrom
fix/midturn-overflow-async-tools
Aug 26, 2026
Merged

VACInc merged 10 commits into
mainfrom
fix/midturn-overflow-async-tools

Conversation

@VACInc

@VACInc VACInc commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

Related: #128963, #128970, #129423

What Problem This Solves

A mid-turn context overflow that lands while a code-mode exec is still waiting on nested tool work never compacts. The run ends in seconds with incomplete turn detected … compactions=0 and the user sees "⚠️ Agent couldn't generate a response. Note: some tool actions may have already been executed — please verify before retrying." The waiting code-mode run is left unresumed; on the reporting session the operator re-prompted 30 minutes later, the model called wait(runId), and got code mode run is unavailable or expired (default snapshotTtlSeconds is 900). The in-flight work was lost.

Observed 2026-08-26 02:01 UTC on a Telegram session (openai/gpt-5.6-sol): [context-overflow-midturn-precheck] route=compact_only estimatedPromptTokens=297335, the persisted exec result was {"status":"waiting","reason":"pending_tools","runId":"cm_…"}, then incomplete turn detected … stopReason=toolUse tools=1 replaySafe=no compactions=0. Two other compactions in the same session minutes earlier succeeded, so this is not the compaction path itself.

Why This Change Was Made

#128970 (fixing #128963) separated "may replay the original attempt" from "may compact and continue from the current transcript", but gated the latter on resolveSettledToolBatchEvidence(attempt).allToolsProvenSettled, which requires the lifecycle counters to be balanced (completedCount === startedCount && activeCount === 0). A code-mode exec suspended with pending_tools has its outer result persisted, yet its nested call keeps a lifecycle item active — verified against the real QuickJS bridge harness: started 1 / completed 0 / active 1 while waiting. So the gate fails closed and attempt-recovery.ts returns the generic replay-unsafe outcome.

That gate protects the wrong thing. Mid-turn continuation activates MID_TURN_PRECHECK_CONTINUATION_PROMPT ("Continue from the current transcript after the latest tool result… do not rerun completed tools") — it never replays the assistant call. What must hold is that the transcript is complete: every tool call in the batch has a recorded result. Nested code-mode work belongs to the code-mode run registry and resumes through wait, which is exactly how it works across ordinary turns.

Change:

  • resolveSettledToolBatchEvidence now also returns allToolCallsRecorded (transcript-only proof: every requested call has a matching persisted result); allToolsProvenSettled is unchanged (= recorded + balanced lifecycle) for its other consumers (intentionalTermination, terminal continuation).
  • The fact is recorded where it happens: the tool completion handler (embedded-agent-subscribe.handlers.tools.completion.ts) marks a result that came back status: "waiting" as codeModeSuspended on its tool meta — but only when the tool is the marked Code Mode exec control tool. That identity comes from the run's post-catalog tool surface (attempt-client-tools.ts collects codeModeExecToolNames from effectiveTools via isCodeModeExecTool, the same WeakSet marker Code Mode uses; the activity wrapper preserves it through copyAgentToolMetadata) and travels to the subscription like replaySafeToolNames; uncompactedEffectiveTools is the pre-catalog bundle and never contains the controls, so it cannot be the source (catalog-level test); a plain exec/bash returning a waiting-shaped result is never marked (producer test). attempt-result.ts carries the fact into the attempt. resolveSettledToolBatchEvidence exposes parkedCodeModeRun (every call recorded and one of this batch's calls carries that fact).
  • attempt-recovery.ts gates canContinueSettledMidTurnOverflow on allToolsProvenSettled or parkedCodeModeRun. Generic tools keep the fully-settled predicate; a generic tool with an active lifecycle item stays fail-closed, and so does "Code Mode enabled but a direct tool is the active one" (codeModeEngaged alone is not evidence — Code Mode can run direct tools). The !hasAsyncActivity condition and the ownership/session checks from fix: resume after settled-tool context overflow #128970 are unchanged.
  • A call with no recorded result remains fail-closed (new test).
  • Session binding (ClawSweeper P1): a parked code-mode run is bound to the session it started in and wait rejects any other session (code-mode-execution.ts runWait). If the overflow compaction adopts a successor session while a Code Mode run is parked — keyed off the recorded codeModeSuspended fact, not lifecycle counters, since a local yield_control parks the exec with no nested item — overflow-context-recovery.ts withholds the mid-turn continuation and surfaces the overflow guidance instead of a retry that would fail on that binding. The compaction itself stays committed: context-engine maintenance, the after_compaction hook, the compaction count, and the post-compaction guard all still run; only the retry (and the tool-result-truncation retry) are skipped. The default safeguard compaction never rotates the session (all observed compactions on the reporting session kept 821434f3…), so the reported case still continues; only rotating engines fail closed there.

Not changed: async-started tools (details.async: true, status: "started") still fail closed as #128970 decided; that case was not observed and is a separate product decision.

User Impact

Long tool-heavy turns that use code-mode no longer die at the context boundary while a nested call is in flight; compaction runs and the agent continues (typically calling wait) within the run's TTL instead of stranding the work and showing the generic side-effect warning.

Evidence

  • Session-store forensics and gateway log for the 02:01 UTC failure (above); scratch run against code-mode.bridge.lifecycle harness confirming {startedCount:1, completedCount:0, activeCount:1} for a waiting exec with reason: "pending_tools".
  • Regression test compacts while a code-mode exec still waits on nested tool work (run.midturn-precheck-retry.test-support.ts): recorded exec result + activeCount: 1 → compaction runs once and the retry continues from the transcript. Fails on pre-fix code (verified by stashing the two production files), passes after.
  • New fail-closed cases a tool call without a recorded result, a generic tool with an active lifecycle item, and a direct tool active while Code Mode is merely enabled keep the generic side-effect warning; each fails without its guard.
  • New fail-closed cases keeps a parked Code Mode run fail-closed when compaction rotates the session (activeCount: 1 and activeCount: 0 / yield_control): recorded parked exec + compaction success carrying sessionId: "rotated-session" → one attempt, "Try /reset (or /new)" guidance. Each fails without its guard (continues into the successor), passes with it.
  • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.shared-integration.test.ts — 73 passed; sibling suites (attempt-recovery, incomplete-turn-*, overflow-*, terminal-resolution) — 131 passed.
  • node scripts/check-changed.mjs: all lanes ok except typecheck core tests, which fails only on ui/vite.config.ts (pako declaration missing in this worktree's shared node_modules after chore(deps): refresh dependencies after seven-day cooldown #129187) — unrelated to this change; zero TS errors in touched files.
  • Production LOC: +72/−7 across eleven files; tests +115/−4.

…pending

#128970 let a mid-turn overflow compact and continue only when every lifecycle
item was balanced. A code-mode exec that returns status "waiting" has its
result persisted, but its nested tool keeps a lifecycle item active, so the
gate failed closed: no compaction, a generic "couldn't generate a response"
warning, and the waiting run expired before the operator could resume it.

Continuation resumes from the persisted tool results and never replays the
assistant call, so the transcript is the settlement proof: gate on every
requested tool call having a recorded result. Nested code-mode work stays
owned by the run registry and resumes through `wait`, exactly as across turns.
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@VACInc
VACInc marked this pull request as ready for review August 26, 2026 02:46
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Aug 26, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 9:08 AM ET / 13:08 UTC.

ClawSweeper review

What this changes

This PR lets mid-turn overflow compaction continue from a persisted Code Mode exec result that is waiting on nested work, while refusing continuation after a session-rotating compaction.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking defect was found in the reviewed PR head: it records the parked-run fact at the tool-result producer, permits only that recorded Code Mode case to bypass lifecycle settlement, and preserves the session-bound wait restriction. Keep this PR open for maintainer handling because it has the protected maintainer label, exact-head CI is still incomplete, and this checkout cannot compare the head with current main due missing promisor objects and DNS failure.

Priority: P1
Reviewed head: 6d1cf2730f5818df9027159ae967dbdf4e809428

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused and its fail-closed cases align with the owner boundary, pending exact-head CI and current-main comparison.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied item metadata identifies a MEMBER/maintainer PR, so the external-contributor proof gate does not apply; the PR body nevertheless documents a production observation and focused harness evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied item metadata identifies a MEMBER/maintainer PR, so the external-contributor proof gate does not apply; the PR body nevertheless documents a production observation and focused harness evidence.
Evidence reviewed 6 items Recorded producer fact: The completion handler marks codeModeSuspended only for a non-error waiting result whose normalized tool name is in the registered Code Mode exec-name set.
Recovery gate: The weaker continuation path requires every current-turn tool result to be recorded and a matching producer-recorded parked Code Mode result; generic active tools still require balanced lifecycle evidence.
Session binding: Code Mode wait rejects a suspended run whose run, session, session key, or agent differs from its owner; the PR's rotation guard therefore prevents an unusable successor-session retry.
Findings None None.
Security None None.

Live Verification

Command: pnpm test src/agents/embedded-agent-runner/run.midturn-precheck-retry.test-support.ts

Result: FAIL (failed) — step 1 run pnpm test src/agents/embedded-agent-runner/run.midturn-precheck-retry.test-support.ts: previous terminal command was still running after 30 seconds: "pnpm test src/agents/embedded-agent-runner/run.midturn-precheck-retry.test-support.ts"

$ node --import tsx scripts/test-projects.mts src/agents/embedded-agent-runner/run.midturn-precheck-retry.test-support.ts
[test] starting test/vitest/vitest.agents-embedded-agent.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-129792-OLCnw2/target

Assertions:

  • FAIL expect_output: compacts while a code-mode exec still waits on nested tool work

How this fits together

The embedded-agent runner recovers when the next model request exceeds its context budget after tools have run. It compacts the persisted transcript and starts a continuation prompt, while Code Mode retains a session-bound suspended run that the model later resumes through wait.

flowchart LR
A[Model turn] --> B[Code Mode exec]
B --> C[Tool result recorded]
C --> D{Mid-turn overflow}
D --> E{Recorded parked Code Mode run}
E -->|yes| F[Compact transcript]
E -->|no| G[Require fully settled tools]
F --> H{Same session retained}
H -->|yes| I[Continue from transcript]
H -->|no| J[Show overflow recovery guidance]
G --> I
Loading

Before merge

  • Resolve merge risk (P1) - Exact-head checks are still queued or running, and the local promisor checkout could not inspect current main or full history because required Git objects could not be fetched.
  • Complete next step (P2) - This protected maintainer PR needs exact-head CI completion and a maintainer merge decision, not an automated repair.
Agent review details

Security

None.

PR surface

Source +165, Tests +43. Total +208 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 13 183 18 +165
Tests 2 43 0 +43
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 226 18 +208

Review metrics

Metric Value Why it matters
Production versus test delta production +72/-7; tests and test support +115/-4 The added production state propagation is concentrated on the producer-to-recovery boundary and is accompanied by focused fail-closed coverage.

Root-cause cluster

Relationship: canonical
Canonical: #129792
Summary: This is a distinct parked-Code-Mode edge case in the settled-tool compaction recovery path; the prior merged fix covered only fully settled tools.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Complete exact-head recovery validation (recommended)
    Wait for the current head's required checks and confirm the focused parked-run regression remains green before merging this session-recovery change.

Technical review

Best possible solution:

Retain the producer-recorded parked-run distinction, then merge only after exact-head validation confirms the focused regression suite and all required checks on this head.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: the focused integration support constructs a recorded waiting exec result with an active nested lifecycle item and asserts one compaction followed by transcript continuation. This review did not execute it because the task requires a read-only checkout.

Is this the best way to solve the issue?

Yes: the fact is captured at the tool-completion producer, matched to the current transcript batch, and consumed narrowly by overflow recovery; broadening generic active-tool continuation would violate the existing fail-closed invariant.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 776986f942dc.

Labels

Label justifications:

  • P1: This addresses agent work being stranded at a context boundary after tool activity.
  • merge-risk: 🚨 session-state: The patch changes transcript continuation and the session identity required to resume parked Code Mode work.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied item metadata identifies a MEMBER/maintainer PR, so the external-contributor proof gate does not apply; the PR body nevertheless documents a production observation and focused harness evidence.

Evidence

What I checked:

Likely related people:

  • VACInc: The supplied PR history shows eight focused revisions addressing this exact Code Mode/overflow recovery boundary. (role: recent area contributor; confidence: high; commits: 56e8dc45625b, 18b24a512acd, 6d1cf2730f58; files: src/agents/embedded-agent-runner/run/attempt-recovery.ts, src/agents/embedded-agent-runner/run/overflow-context-recovery.ts)
  • roboclaw-bot: The supplied related merged PR history identifies the earlier settled-tool compaction implementation that this PR narrows for parked Code Mode work. (role: adjacent feature contributor; confidence: medium; commits: 12e52a1c40e0; files: src/agents/embedded-agent-runner/run/attempt-recovery.ts, src/agents/embedded-agent-runner/run/incomplete-turn-recovery.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm all required checks pass for 6d1cf27.
  • Re-run the focused mid-turn parked-Code-Mode suite on the exact merge head if it changes.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (8 earlier review cycles)
  • reviewed 2026-08-26T02:54:56.190Z sha 56e8dc4 :: found issues before merge. :: [P1] Preserve the Code Mode session binding across a successor compaction
  • reviewed 2026-08-26T03:59:23.536Z sha 58764df :: found issues before merge. :: [P1] Preserve post-compaction hooks after blocking successor retry
  • reviewed 2026-08-26T04:28:36.632Z sha 7a6e5fd :: needs changes before merge. :: [P1] Restrict active-item continuation to Code Mode
  • reviewed 2026-08-26T04:54:44.373Z sha fdba9a3 :: found issues before merge. :: [P1] Gate continuation on a recorded Code Mode suspension
  • reviewed 2026-08-26T05:19:59.802Z sha 16330bc :: needs changes before merge. :: [P1] Require the marked Code Mode control identity
  • reviewed 2026-08-26T05:42:31.555Z sha 707163f :: found issues before merge. :: [P1] Collect the Code Mode identity from the registered tool surface
  • reviewed 2026-08-26T06:04:06.441Z sha 7ff73e5 :: needs changes before merge. :: [P1] Block rotated retries for every recorded parked Code Mode run
  • reviewed 2026-08-26T06:30:49.561Z sha 18b24a5 :: needs maintainer review before merge. :: none

…compaction

A parked code-mode run is bound to the session it started in and `wait`
rejects any other session, so a compaction that adopts a successor session
cannot redeem it. When nested tool work is still parked, treat a rotating
mid-turn compaction as a failed recovery and surface overflow guidance instead
of a continuation that would fail on that binding.
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 26, 2026
VACInc added 4 commits August 26, 2026 00:21
Withholding the mid-turn continuation after a rotating compaction must not
turn the committed compaction into a failure: maintenance, the after hook,
the compaction count, and the post-compaction guard still run. Only the
retry and the tool-result truncation retry are skipped before surfacing the
overflow guidance.
Generic tools keep the fully-settled predicate; only a run with Code Mode
engaged may continue while lifecycle items are active, since that is the
one case where the outer exec result is persisted while the parked nested
call stays owned by the code-mode run registry. A generic tool with an
active item stays fail-closed (new regression).
…spension

codeModeEngaged only says Code Mode controls were enabled for the attempt;
Code Mode can still run direct tools, so a recorded direct-tool result plus
unrelated active lifecycle work could take the weaker branch with no parked
exec to resume. Record the fact where it happens instead: the tool completion
handler marks an exec result that came back "waiting" as codeModeSuspended,
and recovery continues past active items only when the recorded batch carries
that fact. Code Mode enabled with a direct tool active stays fail-closed.
isExecToolName matches any tool named exec or bash, but only the marked Code
Mode exec owns a resumable run. Carry the marked control-tool identity from
the run's tool list (where the tool objects are known) to the subscription
as codeModeExecToolNames, and record codeModeSuspended only for those tools.
A plain exec returning a waiting-shaped result is no longer marked.
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 26, 2026
…tool surface

uncompactedEffectiveTools is the bundle list before the tool catalog creates
the marked Code Mode controls, so the identity set was empty in real Code
Mode runs and the parked-run fact was never recorded. Derive it from the
post-catalog effectiveTools, where the activity wrapper preserves the marker
through copyAgentToolMetadata.
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 26, 2026
…e run

A local yield_control parks the marked exec without creating a nested
lifecycle item, so gating the rotation block on activeCount let that case
retry in the successor session where wait rejects the original binding.
Key the block off the recorded codeModeSuspended fact instead, with a
zero-active-item rotation regression.
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 26, 2026
@VACInc
VACInc enabled auto-merge (squash) August 26, 2026 13:18
@VACInc
VACInc merged commit 7245092 into main Aug 26, 2026
197 checks passed
@VACInc
VACInc deleted the fix/midturn-overflow-async-tools branch August 26, 2026 13:22
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…pending (openclaw#129792)

* fix(agents): compact mid-turn overflow while code-mode work is still pending

openclaw#128970 let a mid-turn overflow compact and continue only when every lifecycle
item was balanced. A code-mode exec that returns status "waiting" has its
result persisted, but its nested tool keeps a lifecycle item active, so the
gate failed closed: no compaction, a generic "couldn't generate a response"
warning, and the waiting run expired before the operator could resume it.

Continuation resumes from the persisted tool results and never replays the
assistant call, so the transcript is the settlement proof: gate on every
requested tool call having a recorded result. Nested code-mode work stays
owned by the run registry and resumes through `wait`, exactly as across turns.

* fix(agents): keep parked code-mode work fail-closed across a rotated compaction

A parked code-mode run is bound to the session it started in and `wait`
rejects any other session, so a compaction that adopts a successor session
cannot redeem it. When nested tool work is still parked, treat a rotating
mid-turn compaction as a failed recovery and surface overflow guidance instead
of a continuation that would fail on that binding.

* fix(agents): keep post-compaction hooks when a rotated retry is withheld

Withholding the mid-turn continuation after a rotating compaction must not
turn the committed compaction into a failure: maintenance, the after hook,
the compaction count, and the post-compaction guard still run. Only the
retry and the tool-result truncation retry are skipped before surfacing the
overflow guidance.

* fix(agents): admit active-item continuation only for Code Mode runs

Generic tools keep the fully-settled predicate; only a run with Code Mode
engaged may continue while lifecycle items are active, since that is the
one case where the outer exec result is persisted while the parked nested
call stays owned by the code-mode run registry. A generic tool with an
active item stays fail-closed (new regression).

* fix(agents): gate active-item continuation on a recorded Code Mode suspension

codeModeEngaged only says Code Mode controls were enabled for the attempt;
Code Mode can still run direct tools, so a recorded direct-tool result plus
unrelated active lifecycle work could take the weaker branch with no parked
exec to resume. Record the fact where it happens instead: the tool completion
handler marks an exec result that came back "waiting" as codeModeSuspended,
and recovery continues past active items only when the recorded batch carries
that fact. Code Mode enabled with a direct tool active stays fail-closed.

* fix(agents): mark a parked run only for the marked Code Mode exec tool

isExecToolName matches any tool named exec or bash, but only the marked Code
Mode exec owns a resumable run. Carry the marked control-tool identity from
the run's tool list (where the tool objects are known) to the subscription
as codeModeExecToolNames, and record codeModeSuspended only for those tools.
A plain exec returning a waiting-shaped result is no longer marked.

* fix(agents): collect the Code Mode exec identity from the registered tool surface

uncompactedEffectiveTools is the bundle list before the tool catalog creates
the marked Code Mode controls, so the identity set was empty in real Code
Mode runs and the parked-run fact was never recorded. Derive it from the
post-catalog effectiveTools, where the activity wrapper preserves the marker
through copyAgentToolMetadata.

* fix(agents): block rotated retries for every recorded parked Code Mode run

A local yield_control parks the marked exec without creating a nested
lifecycle item, so gating the rotation block on activeCount let that case
retry in the successor session where wait rejects the original binding.
Key the block off the recorded codeModeSuspended fact instead, with a
zero-active-item rotation regression.

---------

Co-authored-by: VACInc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant