Skip to content

fix: faulty compaction probe wedges run steering and restart aborts - #154868

Merged
obviyus merged 22 commits into
openclaw:mainfrom
sxh313:fix/embedded-run-compacting-probe-isolation
Sep 26, 2026
Merged

obviyus merged 22 commits into
openclaw:mainfrom
sxh313:fix/embedded-run-compacting-probe-isolation

Conversation

@sxh313

@sxh313 sxh313 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Closes #154700

What Problem This Solves

Fixes: a failing active-run compaction probe escapes message steering and interrupts restart cancellation of other compacting runs. Reply-owned runs also bypassed the guarded registry path.

User Impact

User impact: an unreadable compaction state refuses steering safely, chat follow-ups remain queued until the active run finishes, and compacting-mode cancellation continues to other eligible runs. Healthy steering is unchanged. No configuration, permissions, storage, or public API changes.

Why This Change Was Made

One contained probe reader now serves embedded queue admission, reply-owned injection, and both restart-abort owners. An indeterminate state rejects steering and skips that handle during compacting-only cancellation. A weak set records the first probe failure per handle so repeated admission checks do not flood logs or retain finished runs.

The existing abortability and supersede readers remain beside the compaction reader in the contributor's extracted module. Reply-owned handles use the same containment instead of another exception boundary.

Evidence

Isolated Gateway with a plugin-owned active run and a scripted local HTTP provider; the plugin's isCompacting() throws. No product source was altered to inject the fault.

  • Before, main 9665d17902cf: sessions_send(mode=steer) surfaced the raw compaction probe unavailable exception. A chat.send(queueMode=steer) follow-up was incorrectly delivered to the faulty active backend; the provider recorded the injection.
  • After: the same tool call returns the existing structured queue_message_failed reason=compacting ... gatewayHealth=live rejection. Chat follow-ups are not injected into the faulty backend; the provider sees the next request only after the first finishes. Both turns complete successfully. Repeated checks across the owners produce one warning for that handle.
  • Control, before and after: a healthy probe accepts the follow-up with targetDisposition=steered, and the provider records that exact message.
  • Lifecycle: the isolated Gateway restarts and answers health successfully after the runs settle. The contributor's live queued-compaction regression also proves that a faulty preceding handle does not prevent cancellation, settlement, and registry eviction of the eligible compaction. The reply-registry regression covers the corresponding reply-owned abort sweep.

Focused checks after merging main:

runs.test.ts + runs.steering.test.ts: 69 passed
reply-run-registry.test.ts: 105 passed
Combined wrapper wall time: 30.34 s

compact.hooks.test.ts, faulty-probe case: passed (660 ms test body)
reply-registry throwing-probe and compacting-abort cases: 3 passed
Combined focused wrapper wall time: 30.09 s

The CLI lifecycle import-boundary check exposed an eager diagnostic-facade import from the new shared reader. The reader now imports the same logger directly from its lightweight owner. The existing lifecycle check passes all 3 cases, including signal handling after chunk rotation; rerunning it with both steering/reply owner suites passed 153 tests in 29.23 s without changing test mocks.

The live proof uses synthetic local model responses, not an external model provider. It distinguishes a contained rejection from a raw exception; it does not claim that the baseline Gateway process itself crashed.

Contain handle.isCompacting() at both embedded run-registry boundaries:
queueing fails closed with the structured compacting rejection, and
compacting-mode abort skips an indeterminate handle instead of
abandoning the rest of the loop.
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Sep 21, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 25, 2026, 9:43 PM ET / September 26, 2026, 01:43 UTC (Revision 16).

ClawSweeper review

What this changes

The branch contains compaction-state probe failures so embedded and reply-owned runs refuse unsafe steering while restart cancellation continues past a faulty handle.

Merge readiness

✅ Ready for maintainer review

Current main still lets a throwing compaction probe escape steering and interrupt compacting-run cancellation. The linked report remains open, and this PR has a coherent repair with no actionable finding identified in the introduced diff.

Priority: P2
Reviewed head: 600603dc3359b12361c7538b449f3aaaeb64d2e9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused patch has convincing Gateway-path proof and regression coverage, with no discrete correctness or security defect identified.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body describes before-and-after runs through an isolated Gateway, sessions_send and chat.send, with a plugin-owned throwing probe and a local HTTP provider recording whether injection occurred. After the fix, the tool returned a structured rejection, the chat follow-up waited, healthy steering still worked, and the Gateway answered health after restart; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body describes before-and-after runs through an isolated Gateway, sessions_send and chat.send, with a plugin-owned throwing probe and a local HTTP provider recording whether injection occurred. After the fix, the tool returned a structured rejection, the chat follow-up waited, healthy steering still worked, and the Gateway answered health after restart; no stored-data contract changes.
Evidence reviewed 7 items Current main still has the reported failure path: The current main queue path calls the compaction probe directly at line 778, and its compacting abort loop calls it directly at line 905; either call can throw.
Introduced repair: The shared reader returns an indeterminate result when the probe throws and logs once per handle; embedded queue admission rejects that result, while compacting-only cancellation skips the faulty handle.
Reply-owned path: The reply registry now checks compaction before injecting a message and uses the same contained reader when selecting compacting runs for cancellation.
Findings None None.
Security None None.

How this fits together

The active-run registries decide whether a new message can enter a running agent turn and which runs a Gateway restart should cancel. They read state from the running backend, then return a steering outcome or issue cancellation.

flowchart LR
  A[Incoming message] --> B[Active run registry]
  C[Restart request] --> B
  B --> D[Compaction state probe]
  D --> E{State readable?}
  E -->|No| F[Reject steering or skip handle]
  E -->|Yes| G[Steer or cancel eligible run]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +41, Tests +117. Total +158 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 75 34 +41
Tests 4 138 21 +117
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 213 55 +158

Review metrics

Metric Value Why it matters
Production and test growth production net +41 lines; tests net +117 lines The production growth is mainly the shared contained probe reader; the tests cover steering and cancellation at their owning boundaries.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #154700
Summary: This PR is the candidate repair for the linked open throwing-probe bug.

Members:

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

Technical review

Best possible solution:

Keep one contained compaction-state reader for both run owners, with structured steering rejection and continued cancellation verified through the normal exact-head merge gates.

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

Yes. Current-main source still calls the throwing probe directly at both reported entry points, and the contributor records a before-and-after isolated Gateway scenario; this reviewer did not execute the scenario.

Is this the best way to solve the issue?

Yes. The patch uses one contained reader at the embedded and reply-owned decision points and preserves healthy-probe steering.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 06da80236ed4.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A deterministic probe failure can disrupt steering and restart cleanup, but it requires an uncommon faulty active-run handle.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body describes before-and-after runs through an isolated Gateway, sessions_send and chat.send, with a plugin-owned throwing probe and a local HTTP provider recording whether injection occurred. After the fix, the tool returned a structured rejection, the chat follow-up waited, healthy steering still worked, and the Gateway answered health after restart; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body describes before-and-after runs through an isolated Gateway, sessions_send and chat.send, with a plugin-owned throwing probe and a local HTTP provider recording whether injection occurred. After the fix, the tool returned a structured rejection, the chat follow-up waited, healthy steering still worked, and the Gateway answered health after restart; no stored-data contract changes.

Evidence

What I checked:

  • Current main still has the reported failure path: The current main queue path calls the compaction probe directly at line 778, and its compacting abort loop calls it directly at line 905; either call can throw. (src/agents/embedded-agent-runner/runs.ts:778, 06da80236ed4)
  • Introduced repair: The shared reader returns an indeterminate result when the probe throws and logs once per handle; embedded queue admission rejects that result, while compacting-only cancellation skips the faulty handle. (src/agents/embedded-agent-runner/runs.probes.ts:25, 600603dc3359)
  • Reply-owned path: The reply registry now checks compaction before injecting a message and uses the same contained reader when selecting compacting runs for cancellation. (src/auto-reply/reply/reply-run-registry.message-injection.ts:195, 600603dc3359)
  • Production-path proof in the PR body: The contributor reports an isolated Gateway run using sessions_send and chat.send with a throwing plugin-owned probe: before the change an exception escaped or the faulty backend received an injection; afterward steering returned a structured rejection, the follow-up waited, and a healthy probe still steered. The described local provider trace is behavioral evidence, although this read-only review did not execute it.
  • Focused lifecycle regression: The added case enters live manual compaction, checks structured steering rejection, then verifies the restart sweep aborts and settles the eligible compaction after passing a faulty handle. (src/agents/embedded-agent-runner/compact.hooks.test.ts:6568, 600603dc3359)
  • Feature-history routing: Recent merged history on the embedded-run and reply-registry files identifies Peter Steinberger and Shakker as routing candidates; these commits establish area involvement, not introduction of the faulty probe. (src/auto-reply/reply/reply-run-registry.message-injection.ts, 715077a3befb)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Shakker: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (15 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-24T02:17:56.698Z sha 00286b0 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T02:46:37.971Z sha 4a49c12 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T06:44:48.130Z sha 36c9631 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T08:47:48.819Z sha d83586f :: needs maintainer review before merge. :: none
  • reviewed 2026-09-25T00:40:03.780Z sha 8c85455 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-25T08:18:56.400Z sha a49e62b :: needs maintainer review before merge. :: none
  • reviewed 2026-09-26T00:43:18.499Z sha 11a0764 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-26T01:19:45.641Z sha 1bb0683 :: needs maintainer review before merge. :: none

runs.ts is over the counted-line cap, so the compaction probe shares a sibling
with the abortable and supersede readers it belongs with.
@sxh313

sxh313 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

CI triage for the first head (5a17ef77)

Six checks were red. Two were mine and the follow-up push fixes them:

  • checks-fast-baseline-ratchets - line-cap growth: src/agents/embedded-agent-runner/runs.ts: 1750 -> 1769 counted lines (cap 700). The probe containment now lives in the new runs.probes.ts sibling (with the two existing probe readers that belong beside it), which takes runs.ts to 1,731 counted lines. node --import ./scripts/tsx.mjs scripts/check-line-cap-ratchet.mts --base origin/main reports "Line-cap ratchet OK: 4 changed source files; no new violations or over-cap growth."
  • check-lint-core-2 - typescript(no-unnecessary-boolean-literal-compare) on handle.isCompacting() === true (runs.ts:533). The extracted reader returns boolean | undefined, so the literal comparisons at the two call sites are required and the redundant compare is gone.

Four are outside this diff's blast radius. I am not re-running them to get green; recording what I checked:

  • checks-node-changed-extensions-bundle-19 - extensions/codex/src/app-server/event-projector.output-fidelity.native.test.ts ("preserves the native exec response with max_output_tokens=...", 2 cases, Error: Expected native command execution from event-projector.test-harness.ts:183). Reproduced on the untouched base: with this PR's base commit 10c22915 checked out and no changes applied, node scripts/run-vitest.mjs run extensions/codex/src/app-server/event-projector.output-fidelity.native.test.ts on Windows gives Tests 2 failed (2) with the same assertion. The lane is broken at the base and only reaches this PR because the changed-file plan maps core src/agents edits onto the dependent Codex extension bundle.
  • checks-node-compact-large-26 - src/cron/service.cross-tick-admission-lifecycle.test.ts > gives a waiter-delayed partial-batch wake an independent Gateway root (AssertionError: expected +0 to be 1; 1 of 1,557 tests in the shard).
  • checks-node-compact-large-30 - src/gateway/server-cron.test.ts > holds adopted on-exit work until the previous scheduler drains (start) (1 of 283).
  • checks-node-compact-small-8 - src/cli/update-cli/update-command-migrated.test.ts > fences migrated candidate finalization (4 cases, Error: Test timed out in 30000ms).

The diff changes only how the embedded-run registry reads isCompacting(). I could not construct a path from that to cron cross-tick admission, scheduler drain handoff, or update-CLI candidate finalization timeouts, so these are for their owners; the only behavior this PR adds is on a probe that throws, which no fixture outside the two new regressions supplies.

@sxh313

sxh313 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Second head (cbf6d90f) CI state

171 checks pass on this head, including both gates that were legitimately mine last time
(checks-fast-baseline-ratchets, check-lint-core-2). Four remain red and none is owned by this diff:

  • checks-node-changed-extensions-bundle-19 - unchanged from before: extensions/codex/src/app-server/event-projector.output-fidelity.native.test.ts fails on this PR's untouched base 10c22915 (reproduced locally, Tests 2 failed (2), same Error: Expected native command execution at event-projector.test-harness.ts:183).
  • checks-node-compact-large-27 - src/gateway/server/ws-connection.startup.test.ts (3 cases, ~1.5 s each)
  • checks-node-compact-large-30 - src/agents/main-session-recovery/main-session-restart-recovery.test.ts (3 cases)
  • checks-node-compact-small-7 - src/cli/update-cli/update-command-migrated.test.ts (4 cases, Error: Test timed out in 30000ms)

What I checked rather than re-ran:

  1. The set of failing tests moved between the two heads of this PR (service.cross-tick-admission-lifecycle.test.ts and server-cron.test.ts on the first head, three different files on this one) while the shard indices also shifted. Nothing in this diff changes between the two runs except the probe module extraction.
  2. An unrelated PR was red on the same lane family at the same moment: #154911 checks-node-compact-small-9 fails one stateful test, src/config/sessions/session-accessor.sqlite-reclamation.test.ts (1 failed | 1540 passed | 1 skipped). Same signature: a single store/timing-sensitive file inside an otherwise green shard.
  3. Blast radius: this diff changes only how the embedded run registry reads isCompacting(), and where the three lifecycle probe readers live. abortEmbeddedAgentRun()'s public signature and outcome semantics are unchanged (the widened shouldAbort parameter is a module-private closure type), and the failing assertions are about other owners' state: restart-recovery charge accounting (expected a tombstone, received chargedAttempts: 2), WS startup rate limiting, and update-CLI finalization timeouts. The only behavior this diff adds is reachable when a handle's probe throws, which no fixture outside my two new regressions supplies.

So I am leaving these red and reporting them rather than pushing an empty commit to reshuffle the plan. If a maintainer wants a re-run for a clean signal, that is the moment to do it; otherwise the owner for the compact-shard statefulness and for the Codex native fidelity test should decide.

@sxh313

sxh313 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Update: I now have cross-diff evidence for the three compact-shard failures above. My second, unrelated open PR #154923 (src/agents/bootstrap-routing / bootstrap marker eligibility, no probe or abort code) is red on the same shards with the same files: core-runtime-infra-storage-state-hosted-11 -> 3 cases in src/agents/main-session-recovery/main-session-restart-recovery.test.ts, and agentic-cli-process-hosted-1 -> the same 4 update-command-migrated.test.ts > fences migrated candidate finalization 30 s timeouts. Its agentic-gateway-server-isolated-hosted-2 shard fails a different single file than mine does. Details in that PR's latest comment.

@sxh313

sxh313 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

CI is red here for a reason outside this diff; recording the check so no one waits on me for it.

Every failing shard in 35608713517 is the same two assertions in an existing Codex extension test:

FAIL  extension-database-workers  extensions/codex/src/app-server/event-projector.output-fidelity.native.test.ts
      > native Codex tool response fidelity > preserves the native exec response with max_output_tokens=<redacted len=2|5>
Error: Expected native command execution
  ❯ Module.requireRecord extensions/codex/src/app-server/event-projector.test-harness.ts:183:11
  ❯ extensions/codex/src/app-server/event-projector.output-fidelity.native.test.ts:238:23

Why it is not caused by this PR:

So no code change from me, and I am deliberately not touching the shared harness or narrowing the assertion - that would hide a real upstream failure under my PR's name. I will re-run this branch once the harness issue is resolved upstream and report if anything of mine then fails.

@sxh313

sxh313 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Resolved the merge-blocking failures by bringing this branch up to date rather than touching the shared Codex test.

  • fix/embedded-run-compacting-probe-isolation was 340 commits behind main. Merged origin/main in aeb1a64586 (normal merge commit, no history rewrite); the PR diff is still exactly the 4 files in this change.
  • The shards that failed (checks-node-changed-extensions-bundle-19, checks-node-compact-large-27/30, checks-node-compact-small-7, ci-gate) all died on the same file this PR never edits: extensions/codex/src/app-server/event-projector.output-fidelity.native.test.ts → Error: Expected native command execution at event-projector.test-harness.ts:183.
  • That harness expectation was changed upstream in fix(codex): reset native context after history cuts #155207 (f0cc42f0d5), which edits event-projector.output-fidelity.native.test.ts itself. main's CI is green on it, so the failure was stale-base, not a real regression here.

I deliberately did not narrow, skip or adapt that upstream test from a fork PR. Running the full suite locally isn't possible in this environment, so CI is the verification here — will follow up if anything on the new base still fails.

@sxh313

sxh313 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Correction to my previous comment: I wrote that all the failing shards died on the Codex event-projector test. That was wrong — I had read one job log before writing. Reading the other shards on head cbf6d90f59, four different test files failed, none of them touched by this PR, and each has an upstream fix in the range this merge pulls in:

So the reason the merge should go green is that it lands those four upstream test fixes together — the branch was 340 commits behind main. What I said before still holds otherwise: normal merge commit aeb1a64586 (no history rewrite), PR diff unchanged at its 4 files, and no upstream test skipped, narrowed or adapted from this fork branch. Local full-suite runs aren't available in this environment, so CI on the new head is the verification and I'll report back if anything still fails.

@sxh313

sxh313 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

CI on the merged head aeb1a64586 is still red, and my previous root-cause claim was wrong, so let me correct it rather than let it stand.

Retraction: I said #155207 explained the Codex failure. It does not. f0cc42f0d5 is in this head (it is the most recent commit touching that test file), and the same two cases still fail identically: extensions/codex/src/app-server/event-projector.output-fidelity.native.test.ts > preserves the native exec response with max_output_tokens=… → Error: Expected native command execution at event-projector.test-harness.ts:183. That was sloppy attribution on my part in both earlier comments.

What the base merge did fix: ws-connection.startup.test.ts, main-session-restart-recovery.test.ts and update-command-migrated.test.ts no longer fail on this head.

What fails now (shard numbering is dynamic, so the ids changed):

  • checks-node-changed-extensions-bundle-17 → the Codex case above.
  • checks-node-compact-large-35 → src/agents/worktrees/service.gc.test.ts:348 — Error: Managed command timed out after 60000ms / ETIMEDOUT on "garbage collects a large Git index".
  • checks-node-compact-large-36 → src/gateway/embeddings-http.test.ts plus src/state/openclaw-state-db-borrow.ts.
  • checks-node-compact-large-37 → src/cli/resume-cli.test.ts.
  • openclaw/ci-gate is only the aggregate.

None of these files are in this PR's diff, which is still exactly src/agents/embedded-agent-runner/runs.ts, runs.probes.ts, runs.test.ts, runs.steering.test.ts, and the 60000ms timeout above reads as runner load rather than behaviour. Trunk is not clean either right now: CI run #35689440232 on main fails its node shard on src/llm/openai-compatible-auth.test.ts, and runs around it are cancelled by concurrency.

I cannot re-run failed jobs from a fork (gh run rerun --failed → Must have admin rights to Repository), and I have not edited any CI workflow, any upstream test, or anything outside this PR's scope. Could a maintainer re-run the failed jobs, or say if the Codex output-fidelity case is a known environment-gated failure? Happy to close this out if so.

sxh and others added 4 commits September 23, 2026 12:35
Drives the faulty-probe scenario against a live manual compaction instead of a
second mocked handle, so steering rejection, cancellation and settlement are all
observed through shipped code.
@sxh313

sxh313 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Proof upgraded to the production path at bcd9354b1: the eligible run is now a live compactEmbeddedAgentSession manual compaction (compact.queued.ts:261-292), with only the isCompacting() probe fault injected on a separate session. Red/green runtime output and the four observed facts are in the PR body's "Production-path behavior proof" section.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 23, 2026
@sxh313

sxh313 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

checks-node-compact-large-30 is red on 4a49c1209 with:

FAIL agents-support src/agents/harness/context-engine-turn-maintenance.test.ts > durable accepted-turn maintenance handoff >
  returns before maintenance settles and retains resources (committed, failure=false | duplicate, failure=false | committed, failure=true | duplicate, failure=true)
AssertionError: expected "vi.fn()" to be called once, but got 0 times

Nothing under src/agents/harness/ is in this branch — the diff is embedded-agent-runner probes plus runs.probes.ts, and the only hand-resolved hunk in the main merge was abortEmbeddedAgentRun. The same test is red on #156769 (shard -30) and #154923 (shard -31), three PRs with disjoint diffs that all just took main; #156766 (P1, 2026-09-23) reports the same never-queued maintenance behaviour. Recording it here rather than touching that test, its baseline, or its shard selection.

@sxh313

sxh313 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Post-sync readout for 36c9631bc57 (all 85 node shards complete): the red shards went from 2 to 1. The one left is checks-node-changed-compact-large-43 (job 107523879462) — src/agents/embedded-agent-runner/context-engine-maintenance.ownership.test.ts:253, AssertionError: expected "vi.fn()" to be called once, but got 0 times, pool label [shard:core-runtime-infra-storage-state-hosted-13].

Same assertion, same pool, same window on #156769 and #156723 (both src/cli/-only) and on #154923, and this file was already red on my pre-merge head, so the merge did not introduce it. Analysis with the upstream candidates is in #156769 (comment) — summarising it here would just be noise. Not editing that test or the scheduler from this PR.

@sxh313

sxh313 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

The single red shard above is a stale base that upstream has already fixed, not this diff.

3b1f03721 (test(agents): await foreign maintenance startup in ownership fixtures, 2026-09-24T07:04:01Z) rewrote context-engine-maintenance.ownership.test.ts 29 minutes after this head merged main (36c9631bc57, 06:34:36Z). This head still has the pre-fix blob bd83d9f27f182caa5062c34c5df579e81289a99e; current main and three other post-fix PR heads have ebcd5ca173005b5918111d19ccff971b8503757e and are not red on it. This PR changes compact.hooks.test.ts, runs*.ts/probes.ts in the same directory but neither the failing file nor context-engine-maintenance.ts. Full evidence: #156769 (comment).

check-additional-runtime-topology-architecture and check-test-types on this head were cancelled, not failed, so they await a rerun.

@sxh313

sxh313 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

CI fact for anyone reading this before the rerun: the only red gate on head d83586f0a is not an assertion.

$ gh api repos/openclaw/openclaw/check-runs/107558970835 --jq '[.name,.status,.conclusion,.started_at,.completed_at]|@tsv'
check-test-types	completed	cancelled	2026-09-24T08:42:56Z	2026-09-24T09:03:11Z

$ gh api repos/openclaw/openclaw/check-runs/107558970835/annotations --jq '.[] | .path + " :: " + .message'
.github :: The job has exceeded the maximum execution time of 20m0s
.github :: The operation was canceled.

So check-test-types ran to its 20-minute ceiling and was killed; the openclaw/ci-gate row (107572383310) is what turns that into a red gate, annotating check-shard finished with cancelled (selected=true) plus Process completed with exit code 1.. The job id and the 08:42:56Z -> 09:03:11Z window are unchanged across readings since, i.e. it has not been re-queued rather than retried and failed again. As a fork contributor I cannot rerun it, so this is recorded here for a maintainer rerun instead of being papered over with a push.

The rest of the lane set at this reading: gh pr checks 154868 --json bucket | sort | uniq -c → 2 fail / 136 pass / 1 cancel / 43 skipping, where both fail rows are openclaw/ci-gate aggregators and the cancel row is check-test-types above. No test assertion on this head names a failure.

@obviyus
obviyus merged commit 12e8edc into openclaw:main Sep 26, 2026
191 checks passed
@obviyus

obviyus commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

Merged as 12e8edc. Compaction probe failures now fail closed across embedded and reply-owned steering, allow cancellation of other eligible compacting runs, and log once per handle. Isolated Gateway before/after and healthy-control proof confirmed safe rejection, queued follow-up completion, and restart health; focused lifecycle/reply/steering tests passed, with green CI and a ready review on the merged head. Thank you @sxh313 for the fix and regression coverage, and @yunligou711-commits for the report!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
…penclaw#154868)

Closes openclaw#154700

## What Problem This Solves

Fixes: a failing active-run compaction probe escapes message steering and interrupts restart cancellation of other compacting runs. Reply-owned runs also bypassed the guarded registry path.

## User Impact

User impact: an unreadable compaction state refuses steering safely, chat follow-ups remain queued until the active run finishes, and compacting-mode cancellation continues to other eligible runs. Healthy steering is unchanged. No configuration, permissions, storage, or public API changes.

## Why This Change Was Made

One contained probe reader now serves embedded queue admission, reply-owned injection, and both restart-abort owners. An indeterminate state rejects steering and skips that handle during compacting-only cancellation. A weak set records the first probe failure per handle so repeated admission checks do not flood logs or retain finished runs.

The existing abortability and supersede readers remain beside the compaction reader in the contributor's extracted module. Reply-owned handles use the same containment instead of another exception boundary.

## Evidence

Isolated Gateway with a plugin-owned active run and a scripted local HTTP provider; the plugin's `isCompacting()` throws. No product source was altered to inject the fault.

- **Before, main `6b8c6921ac83`:** `sessions_send(mode=steer)` surfaced the raw `compaction probe unavailable` exception. A `chat.send(queueMode=steer)` follow-up was incorrectly delivered to the faulty active backend; the provider recorded the injection.
- **After:** the same tool call returns the existing structured `queue_message_failed reason=compacting ... gatewayHealth=live` rejection. Chat follow-ups are not injected into the faulty backend; the provider sees the next request only after the first finishes. Both turns complete successfully. Repeated checks across the owners produce one warning for that handle.
- **Control, before and after:** a healthy probe accepts the follow-up with `targetDisposition=steered`, and the provider records that exact message.
- **Lifecycle:** the isolated Gateway restarts and answers `health` successfully after the runs settle. The contributor's live queued-compaction regression also proves that a faulty preceding handle does not prevent cancellation, settlement, and registry eviction of the eligible compaction. The reply-registry regression covers the corresponding reply-owned abort sweep.

Focused checks after merging main:

```text
runs.test.ts + runs.steering.test.ts: 69 passed
reply-run-registry.test.ts: 105 passed
Combined wrapper wall time: 30.34 s

compact.hooks.test.ts, faulty-probe case: passed (660 ms test body)
reply-registry throwing-probe and compacting-abort cases: 3 passed
Combined focused wrapper wall time: 30.09 s
```

The CLI lifecycle import-boundary check exposed an eager diagnostic-facade import from the new shared reader. The reader now imports the same logger directly from its lightweight owner. The existing lifecycle check passes all 3 cases, including signal handling after chunk rotation; rerunning it with both steering/reply owner suites passed 153 tests in 29.23 s without changing test mocks.

The live proof uses synthetic local model responses, not an external model provider. It distinguishes a contained rejection from a raw exception; it does not claim that the baseline Gateway process itself crashed.

Co-authored-by: sxh <[email protected]>
Co-authored-by: Ayaan Zaidi <[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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

[Bug]: Run steering crashes when isCompacting() throws instead of failing closed

2 participants