Skip to content

fix: Muse requests stall or lose approval authority after reuse - #183676

Open
pstarkgit wants to merge 5 commits into
openclaw:mainfrom
pstarkgit:fix/muse-native-progress
Open

pstarkgit wants to merge 5 commits into
openclaw:mainfrom
pstarkgit:fix/muse-native-progress

Conversation

@pstarkgit

@pstarkgit pstarkgit commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #183672
Related: #183282 (independent compaction fallback repair).

What Problem This Solves

Muse requests can time out behind retained native work, replay an earlier answer into a new reply, or fail with missing scope: operator.approvals after reusing a process created by a narrower caller.

User Impact

Status requests can join native work and receive its current answer. Approval requests use the current admitted caller while preserving genuine System scope limits and revoked-owner checks. Stopping an observation of earlier work detaches that observation; turns started by the current request retain normal cancellation.

Why This Change Was Made

Use ifBusy: "steer" and the SDK's authoritative started/joined identity. Observe real native tool progress, keep historical items out of the current reply, and fence publication after asynchronous transcript append.

Install approvals before resume traffic and bind each new handler to its prepared attempt context. Pooled stdio callbacks otherwise inherit the process creator's async context. Keep authority checks before host approval and native decisions, cancel pending approval UI when observation ends, and retire a failed SDK projection so a fresh owner can recover the same native session and approval stage.

This keeps approval handling in the harness and transcript/result projection in its existing event owner. No provider, dependency, configuration, permission-policy, or transcript-schema changes.

Evidence

Validation ran on an isolated macOS arm64 host with Node 24.22.1, task-owned state, and the package-pinned SDK. Tested and committed source files were verified byte for byte.

Current head da67db5d0bfc054fddaf142d884afd2af5209c13 integrates main d4ae3a73118767a3f9bf80625a91733d19055393. Its only conflict was the controlled MSP test helper; the resolution preserves both the native approval-effect controls and upstream helper simplifications. The Muse production harness, event owner, and process pool remain byte-identical to the native-tested parent 15457a3a. All 60,327 tracked candidate blobs matched the isolated Gronk checkout. The 73 controlled tests, focused source and package-boundary typechecks, typed lint, formatting, and independent conflict-resolution review passed again against the integrated source and frozen current-main lockfile. The maintained lint owner prepared the SDK boundary declarations; no core/app build or additional real-model run was performed.

Parent and integrated-head evidence:

  • 73 canonical tests passed: the four non-live Muse suites (71) plus two real-SDK pooled-context regressions. These cover reply/history isolation, joined abort/timeout, native settlement lifetime, resume-time approval replay, deferred transcript publication, offered refusal safety, and completed-first history.
  • The pooled-context regression failed before the fix with the exact missing-scope error. After the fix, one physical peer serves both attempts, approval dispatch carries the current run identity, and exactly one offered approval decision produces the native filesystem effect. The inverse control keeps full admitted authority under a genuinely narrow current System frame and verifies denial with no effect.
  • Existing real-SDK controls verify that detached or revoked observations cannot make a native approval decision or effect, and that a fresh owner recovers the same pending stage. Their late-request barrier is causal. Tool-progress fixtures likewise wait for production observation rather than a fixed sleep.
  • Package and focused regression typechecks, changed-file typed lint, formatting, and diff checks passed.
  • Independent P0–P2 source review and structured autoreview found no blocking defects. The final equivalent factory capture location received a focused caller-chain review; review did not substitute for test execution.

Captured controlled-fixture results:

uses the current full approval owner after reusing a pooled native peer: PASS
uses the current narrow approval owner after reusing a pooled native peer: PASS
Tests  2 passed (2)
Test Files  4 passed (4)
Tests  71 passed (71)

A matching operator compatibility port also passed a real isolated public Gateway approval-manager flow using SDK 1.4.2 and a controlled MSP peer: narrow warmup → full approval produced a final reply through the same physical host; full warmup → narrow caller remained denied. Its 28 regression controls passed. This is compatibility-port acceptance, not canonical SDK 1.4.10 native-provider/busy-turn qualification.

Real native-provider authority evidence was also captured on exact head 15457a3aebf4124de78ade51d6d478e31ee3e95c: SDK 1.4.10, official Muse 1.4.13-R6996.1, Meta provider, Node 24.22.1/macOS arm64, and the published declared-compatible OpenClaw 2026.10.10-beta.3 host. The selected Muse target was built without changing minHost/compatibility metadata; this was not an all-main Gateway build. Native permissions used task-only :ask-me, with exact prehashed effects confined to the owned sandbox workspace.

  • A genuine narrow warmup followed by a full current owner reused the same physical native host. One public plugin approval and one offered allow decision produced the exact owned effect after resolution.
  • A separate native conversation on that same pool was warmed by a full owner, then resumed by a client negotiated with only operator.read and operator.write. Its real native approval request failed closed: one offered abort decision, zero allow decisions, zero plugin approval events, and no effect after all owned processes ended. The missing-scope Gateway diagnostic was fenced to that admitted run.
  • The inverse runner's original FAIL remains preserved: agent.wait returned error: "agent run failed" without the detailed scope string its assertion required. Independent scoped adjudication accepted the authority behavior from the matched wire, run, diagnostic, and filesystem evidence; the runner was not relabeled green.

Captured redacted native result:

{
  "head": "15457a3a",
  "sdk": "1.4.10",
  "samePhysicalPooledHost": true,
  "fullOwnerApprovedEffect": true,
  "narrowOwner": {
    "nativeAbort": 1,
    "nativeAllow": 0,
    "pluginApprovalEvents": 0,
    "effectAbsent": true
  },
  "originalInverseRunnerPassed": false,
  "scopedAuthorityAdjudication": "accepted"
}

The real-SDK controlled subprocess tests remain the evidence for busy-turn, cancellation, detached/revoked-owner, and same-stage recovery behavior. Real-native busy-resume, joined Stop, detached/revoked-owner, and same-stage recovery qualification remains outstanding. Maintainer direction on joined-work Stop, timeout, and reset semantics also remains outstanding; the native authority evidence does not resolve those lifecycle or merge-readiness gaps.

@clawsweeper

clawsweeper Bot commented Oct 25, 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 docs Improvements or additions to documentation plugin: muse size: L labels Oct 25, 2026
@pstarkgit
pstarkgit marked this pull request as ready for review October 25, 2026 15:36
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 25, 2026
@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 15457a3aebf4124de78ade51d6d478e31ee3e95c, but the PR head is now da67db5d0bfc054fddaf142d884afd2af5209c13. Its old verdict and PR readiness labels are no longer current.

Next step
Comment @clawsweeper re-review when the current head is ready; pushes after the first review are not reviewed automatically.

Review history (4 earlier review cycles)
  • reviewed 2026-10-25T15:54:53.021Z sha 60cf4ba :: needs real behavior proof before merge. :: [P2] Exclude earlier answers from the joined request’s live output | [P2] Keep the single-consumer approval operation in its harness owner
  • reviewed 2026-10-25T18:39:40.994Z sha 5bd14ef :: needs real behavior proof before merge. :: [P2] Make the diagnostic positive control pass in the extension shard | [P2] Avoid the new unbound-method suppression
  • reviewed 2026-10-25T21:14:56.467Z sha 37ff2ee :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-25T22:48:35.826Z sha 15457a3 :: needs real behavior proof before merge. :: none

@pstarkgit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 25, 2026
@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Oct 26, 2026
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 28, 2026
@saariuslystoned

Copy link
Copy Markdown
Contributor

Related: #194963. I reproduced a separate Muse gap-recovery concern on current main 7e0e2513f584989392b2287652f5ef18a5e0ef8e, SDK1.4.14: failed activity paging retains the genuine native answer/ok but silently loses a tool item. In an independent disposable-write control, one witnessed append accompanies replaySafe:true / hadPotentialSideEffects:false. Successful recovery and no-tool controls distinguish the condition. No automatic retry or duplicate effect was executed.

Exact replay inputs, current-main receipts and hashes. The second unchanged run has three positive passes/two target failures; the initial additional15s timeout is retained and unexplained.

The minimum proposal is to observe settled session.fold.current, emit the existing System notice/operator warning for a completed but incomplete projection, and make the existing replay metadata conservative. Preserve native answer/terminal, host lifetime and all prior conservative conditions; no retained per-caller gap callback or general retry change.

Your inspected head da67db5d0bfc054fddaf142d884afd2af5209c13 moves the exact metadata expressions into events.ts projectMuseAttemptResult, alongside your observation/projection ownership. That integration overlap is why I’m flagging the concern here before a separate repair PR. I have not changed your branch, approval/retention work or #178837’s prefix algorithm. Please flag if you are already covering this; otherwise I’ll keep any main-based repair isolated to these reporting/metadata guards and explicitly link the integration point.

@saariuslystoned

Copy link
Copy Markdown
Contributor

Sharing a bounded recorded Muse usage-handoff finding for the finalization path owned by this PR. At OpenClaw eeb8a98 with SDK 1.4.14, the actual harness → pool → owned synthetic MSP → SDK path retained completed-turn usage 300 input / 30 output (and explicit measured zero in an opposite case), but returned no attemptUsage and passed default-zero assistant usage to the intercepted transcript writer. The answer and terminal ok were retained.

Programs, complete original receipts/log, source hashes and qualification. The recorded run was 2 intended failures / 1 pass. Both failures stop at the coarse observation check on line 236; the output-30 assertion on line 237 did not run, input 300 is not asserted outward, and the zero/unknown controls need sharper report-state assertions before serving as a repair gate. This is intercepted writer input, not durable storage, full runner/UI, provider, quota or billing proof. Current main b595ee78 was inspected only as source, not rerun.

Your captured head da67db5 owns the relevant consumeTurn terminal return, recordMuseTranscriptGroup append/publish, projectMuseAttemptResult and harness finalization call. Would you prefer to preserve known terminal usage within that existing observer/finalization path? That is the recommended route to keep one writer, with the tradeoff that delivery follows the broader PR. Alternatively, an explicit bounded usage-finalization slice handoff would allow a separate isolated repair after the sharper controls are admitted. No owner consent, competing repair or automatic aggregation policy is assumed. The earlier gap-metadata coordination comment is a separate concern.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. plugin: muse size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Muse status requests time out after resuming native background work

2 participants