Skip to content

fix(setup): prevent Local AI routing ambiguity after rerun - #1282

Merged
shanselman merged 8 commits into
openclaw:mainfrom
joelagnel:fix/1251-stale-managed-gateway-duplicates
Sep 3, 2026
Merged

shanselman merged 8 commits into
openclaw:mainfrom
joelagnel:fix/1251-stale-managed-gateway-duplicates

Conversation

@joelagnel

@joelagnel joelagnel commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1251

What Problem This Solves

Rerunning local setup could leave multiple SetupEngine-managed gateway records for the same local URL when an unmanaged or protected record appeared first in registry order. Those duplicates could make Local AI gateway ownership ambiguous.

Why This Change Was Made

Cleanup now examines every URL-equivalent gateway record and removes every record owned by the current SetupEngine-managed distro. It preserves unmanaged and legacy records, records protected by another distro owner, remote records, SSH-tunneled records, and non-equivalent endpoints.

The complete registry and active-ID transition is persisted before identity directories are deleted. If an identity cannot be deleted, only that record is restored, including its active ID when applicable, so setup can retry without resurrecting records that were cleaned successfully.

User Impact

Users can rerun local setup without stale managed duplicates confusing Local AI routing. Existing unrelated gateway records and identities remain intact.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • windows-wsl-gateway-e2e: setup rerun cleanup and managed gateway ownership behavior changed.

Validation

Validated at a5867d339a4079b137842523d6cb9f1de4944499 after merging current origin/main without rebase or force.

  • .\build.ps1: passed. All five repository projects built.
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: passed, 3,905 passed, 32 skipped, 0 failed.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: passed on full rerun, 2,833 passed, 0 skipped, 0 failed. The first full run had one unchanged onboarding bootstrap timeout; that exact test then passed 3/3 focused reruns before the clean full rerun.
  • dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj: passed, 709 passed, 0 skipped, 0 failed.
  • dotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj: passed, 1,033 passed, 0 skipped, 0 failed.
  • dotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj --no-restore --filter 'FullyQualifiedName~CleanupStaleGateway': passed, 8 passed, 0 skipped, 0 failed.
  • Exact-head GitHub CI run 33794747399: passed. Aggregate tests, all three Gateway E2E shards, repo hygiene, and x64/ARM64 builds succeeded.
  • git diff --check: passed.
  • python .agents\skills\autoreview\scripts\autoreview --mode branch --base origin/main --stream-engine-output: clean, no accepted or actionable findings, confidence 0.88.
  • Rubber-duck review: no blocking defects. Narrow exception coverage and crash-between-save-and-delete cleanup were classified as non-blocking follow-up risks.

Real behavior proof

Current-head cleanup behavior

The focused current-head run invoked the production CleanupStaleGatewayStep and GatewayRegistry against real temporary filesystem state. All 8 tests passed. The mixed-record regression placed an unmanaged active record before two URL-equivalent setup-managed duplicates and proved that both managed identities and records were removed while unmanaged, other-distro, remote, SSH-tunneled, and non-equivalent records plus identities were preserved. The locked-identity test proved that only the failed record and its active ID are restored, then removed on retry.

Current-head Gateway path

All three hosted Gateway E2E shards passed at the refreshed head, including setup-connect, revocation-recovery, and network-recovery.

A local windows-wsl-gateway-e2e attempt was blocked before the changed cleanup step. wsl.exe failed to mount the proof-owned temporary swap.vhdx with Wsl/InstallDistro/Service/RegisterDistro/CreateVm/MountDisk/E_ACCESSDENIED. The isolated setup rolled back and removed the proof state. This local host result is recorded as blocked, not passed.

Failure reproduction before the fix

The original setup-rerun failure surfaced No API key found for provider "openai" while Local AI was selected.

Local AI request incorrectly reports that no OpenAI API key was found

Screenshot link verified: yes. This is before-fix evidence, not current-head runtime proof.

Maintainer decision

The remaining failed-restoration-save case is accepted as a bounded, non-blocking MVP recovery risk. The primary invariant is preserved: the registry is durably updated before identity deletion, so it never references an identity that was already removed. The residual case requires two consecutive filesystem failures, first identity deletion and then persistence of the restored retry record. Setup reports failure, but recovery may require manual cleanup. A durable transaction journal would materially expand this focused repair.

Security Impact

  • New permissions or capabilities? (Yes/No): No.
  • Secrets or tokens handling changed? (Yes/No): No.
  • New or changed network calls? (Yes/No): No.
  • Command or tool execution surface changed? (Yes/No): No.
  • Data access scope changed? (Yes/No): No.
  • If any answer is Yes, explain the risk and mitigation: N/A.

Compatibility and Migration

  • Backward compatible? (Yes/No): Yes.
  • Config or environment changes? (Yes/No): No.
  • Migration needed? (Yes/No): No.
  • If yes, list the exact upgrade steps: N/A.

Review Conversations

  • No unresolved review conversations remain on this PR.

Clean up every setup-managed record matching the local gateway URL while preserving legacy, remote, and SSH-tunneled entries. This prevents setup reruns from leaving ambiguous Local AI ownership behind.

Fixes openclaw#1251.
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. 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 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed September 3, 2026, 3:13 PM ET / 19:13 UTC.

ClawSweeper review

What this changes

The PR removes every URL-equivalent gateway record owned by the current setup-managed WSL distro during rerun cleanup, preserves protected records, and adds duplicate and deletion-failure tests.

Merge readiness

⛔ Blocked before merge - 5 items remain

Keep this PR open. It addresses a real setup-rerun defect, but it still needs current-head after-fix gateway proof and a decision on the remaining restoration-save failure that can leave a retained identity without its registry record.

Priority: P2
Reviewed head: a5867d339a4079b137842523d6cb9f1de4944499
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has focused coverage and a real routing fix, but lacks after-fix runtime proof and retains a concrete persistence-recovery defect.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: The changed production owner is setup-rerun cleanup of persisted gateway records and identities. Focused tests cover the modeled record states, but the supplied image is before-fix and the reported current-head WSL run rolled back before cleanup could be seeded and rerun, so no after-fix Local AI route was observed. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The changed production owner is setup-rerun cleanup of persisted gateway records and identities. Focused tests cover the modeled record states, but the supplied image is before-fix and the reported current-head WSL run rolled back before cleanup could be seeded and rerun, so no after-fix Local AI route was observed. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 4 items Introduced cleanup path: The PR gathers all URL-equivalent records, removes the qualifying records, saves the registry, then restores failed identity-deletion records and saves again. If the second save fails, the on-disk registry remains without the restored record although its identity directory remains.
Focused coverage: The added tests cover mixed managed/protected records, cleared active IDs, and an identity-delete failure followed by a successful restoration save, but do not exercise a failed restoration save.
Prior repair provenance: The history identifies Scott Hanselman's retry-restoration repair as commit 7c59be9, with parent 15ca7f0.
Findings 1 actionable finding [P2] Keep restored retry records durable
Security None None.

How this fits together

Setup reruns clean persisted local-gateway records and their per-gateway identities before provisioning a new WSL gateway. The registry determines the active connection route that Local AI uses after setup completes.

flowchart LR
  A[Setup rerun] --> B[Gateway registry]
  B --> C[Classify matching records]
  C --> D[Preserve remote and protected records]
  C --> E[Remove current-distro duplicates]
  E --> F[Persist registry and active route]
  F --> G[Delete stale identities]
  G --> H[Local AI gateway routing]
Loading

Decision needed

Question Recommendation
Should this PR require durable recovery across a failed restoration save, or may MVP accept an orphaned retry identity after two consecutive filesystem failures? Require durable recovery: Add a recovery mechanism and regression coverage so retry state survives a restoration-save failure before merge.

Why: The contributor explicitly requests acceptance of this remaining persistence failure mode, while making it fully durable likely requires a transaction or journal design rather than a small local change.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The changed production owner is setup-rerun cleanup of persisted gateway records and identities. Focused tests cover the modeled record states, but the supplied image is before-fix and the reported current-head WSL run rolled back before cleanup could be seeded and rerun, so no after-fix Local AI route was observed. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Keep restored retry records durable (P2) - This remains the prior blocker: if identity deletion fails and the restoration Save() at this line also fails, the earlier successful removal is still the only durable registry state. The retained identity then has no record for the next rerun to retry, contrary to the recovery claim. Preserve a durable recovery intent or otherwise handle the second save failure.
  • Resolve merge risk (P1) - A second registry-save failure after identity deletion fails leaves the durable registry without the restored retry record while its identity remains on disk, so the next setup rerun cannot reliably retry that cleanup.
  • Complete next step (P2) - Before merge, make failed-record restoration durable or explicitly accept the bounded recovery risk, and add redacted current-head proof of a successful setup rerun followed by a Local AI request using the local provider.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P2] Keep restored retry records durable — src/OpenClaw.SetupEngine/CleanupStaleGatewayStep.cs:103
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production +65/-9, tests +165 The focused three-file change adds substantial regression coverage, but the persistence recovery boundary remains untested.

Merge-risk options

Maintainer options:

  1. Make retry restoration durable (recommended)
    Persist a recoverable cleanup intent or equivalent rollback state and add a forced restoration-save-failure regression before merge.
  2. Accept the bounded recovery gap
    Maintain the current implementation only if maintainers explicitly accept that two consecutive filesystem failures can orphan retry state.

Technical review

Best possible solution:

Use a durable cleanup transaction or recovery journal so a failed identity deletion and any subsequent persistence failure cannot orphan retry state, then attach redacted current-head setup-rerun output showing the first Local AI request reaches the local provider.

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

Yes. The focused setup fixture can seed an unmanaged record ahead of multiple current-distro URL-equivalent records and invoke cleanup, though the PR lacks a real current-head WSL setup-rerun trace.

Is this the best way to solve the issue?

No. The duplicate-removal approach is appropriately narrow, but the claimed retry recovery is not durable if its restoration save fails; current-head after-fix behavior also remains unobserved.

Full review comments:

  • [P2] Keep restored retry records durable — src/OpenClaw.SetupEngine/CleanupStaleGatewayStep.cs:103
    This remains the prior blocker: if identity deletion fails and the restoration Save() at this line also fails, the earlier successful removal is still the only durable registry state. The retained identity then has no record for the next rerun to retry, contrary to the recovery claim. Preserve a durable recovery intent or otherwise handle the second save failure.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The changed production owner is setup-rerun cleanup of persisted gateway records and identities. Focused tests cover the modeled record states, but the supplied image is before-fix and the reported current-head WSL run rolled back before cleanup could be seeded and rerun, so no after-fix Local AI route was observed.
  • remove merge-risk: 🚨 auth-provider: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.

Label justifications:

  • P2: This is a bounded setup and Local AI routing repair with a concrete persistence-recovery defect, not an emergency outage.
  • merge-risk: 🚨 compatibility: The changed cleanup writes persisted gateway and active-route state, and a restoration-save failure can leave existing retry state inconsistent.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The changed production owner is setup-rerun cleanup of persisted gateway records and identities. Focused tests cover the modeled record states, but the supplied image is before-fix and the reported current-head WSL run rolled back before cleanup could be seeded and rerun, so no after-fix Local AI route was observed. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The changed production owner is setup-rerun cleanup of persisted gateway records and identities. Focused tests cover the modeled record states, but the supplied image is before-fix and the reported current-head WSL run rolled back before cleanup could be seeded and rerun, so no after-fix Local AI route was observed.

Evidence

What I checked:

Likely related people:

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

Rank-up moves

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

  • Make retry-state restoration durable when the second registry save fails and add a forced-failure regression.
  • Attach redacted current-head setup-rerun output that reaches cleanup and shows the first Local AI request using the local provider.

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-09-01T19:45:03.607Z sha 269c370 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-02T17:24:05.061Z sha 269c370 :: needs real behavior proof before merge. :: [P2] Make duplicate cleanup recoverable across a save failure
  • reviewed 2026-09-02T18:06:40.418Z sha cdedf07 :: needs real behavior proof before merge. :: [P2] Persist the complete cleanup before deleting identities
  • reviewed 2026-09-02T18:29:35.206Z sha ab0b02d :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-02T19:03:49.512Z sha ab0b02d :: needs real behavior proof before merge. :: [P2] Preserve failed records when the restoration save fails
  • reviewed 2026-09-02T20:09:28.764Z sha ab0b02d :: needs real behavior proof before merge. :: [P2] Make failed-record restoration durable
  • reviewed 2026-09-02T20:19:01.896Z sha ab0b02d :: needs real behavior proof before merge. :: [P2] Make failed-record restoration durable across a failed save
  • reviewed 2026-09-03T15:04:49.170Z sha ab0b02d :: needs real behavior proof before merge. :: [P2] Make failed-record restoration durable

@karkarl

karkarl commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Adversarial consensus review

Verdict: No CRITICAL or HIGH-severity defect was found at 269c3703ecfb. The loop is snapshot-safe and retains the existing ownership guard, but the exact mixed duplicate scenario this PR fixes has no regression coverage. Add that coverage before merge. A lower-consensus partial-failure concern is also worth hardening because this PR repeats a destructive remove/save boundary for every duplicate.

Both models agree: HIGH consensus

Issue Opus Codex Fix confidence
The exact bug shape is untested: an older unmarked or protected URL-equivalent record precedes multiple setup-managed duplicates, which must all be removed while protected records remain. No test covers mixed ordering, loopback aliases, both identity deletions, and persisted reload state. MEDIUM LOW 99%

Only one model flagged: LOW consensus

Issue Opus Codex Fix confidence
Per-record Remove + Save, with identity deletion before persistence, can fail after earlier duplicates were persisted. The remaining on-disk record may then point at an already-deleted identity. — MEDIUM 85%
The new public FindAllByUrl contract has no direct all-matches and no-match unit coverage. LOW — 99%

Disputed finding assessment: The partial-failure concern is real but partly pre-existing for one record. PR #1282 materially widens it to repeated deletion/save attempts and permits partial progress across duplicates. Prefer gathering all removable records, persisting one registry update, then deleting identities, with a focused forced-save-failure test. This is an edge-case recovery risk, not a demonstrated common-path failure.

Validation scope: Two independent rubber-duck reviews used the same packet with Claude Opus 4.6 and GPT-5.3 Codex. Adjudication covered the complete two-file diff plus registry URL normalization/persistence, setup ownership, pipeline order, rerun and rollback behavior, Local AI manifest/provider routing, distro resolution, cleanup tests, linked issue evidence, and current CI. Collection mutation, unrelated remote/tunnel deletion, manifest staleness, credential precedence, and stable-record compatibility were investigated and not found to regress. Existing setup/recovery E2E shards pass; the remaining CI failure is an unrelated Sandbox page accessibility readiness timeout. No live setup-rerun proof was supplied or run.

@shanselman shanselman added the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Sep 2, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. label Sep 2, 2026
Persist removal of all equivalent setup-managed gateway records before deleting their identity directories. Cover mixed protected records, active identity preservation, and multiple managed duplicates.

Co-authored-by: Copilot App <[email protected]>
@joelagnel
joelagnel force-pushed the fix/1251-stale-managed-gateway-duplicates branch from 269c370 to f1399d1 Compare September 2, 2026 17:40
joelagnel and others added 2 commits September 2, 2026 10:44
Clean up every setup-managed record matching the local gateway URL while preserving legacy, remote, and SSH-tunneled entries. This prevents setup reruns from leaving ambiguous Local AI ownership behind.

Fixes openclaw#1251.

(cherry picked from commit 269c370)
Restore only records whose identity directories could not be removed, including a removed active record, while keeping successful duplicate cleanup durable.

Co-authored-by: Copilot App <[email protected]>
@joelagnel
joelagnel force-pushed the fix/1251-stale-managed-gateway-duplicates branch from f1399d1 to cdedf07 Compare September 2, 2026 17:57
@joelagnel

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 2, 2026
shanselman and others added 2 commits September 2, 2026 11:08
Preserve the repaired cleanup implementation while connecting the contributor branch history for a non-force fast-forward update.

Co-authored-by: Copilot App <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 2, 2026
@joelagnel

Copy link
Copy Markdown
Collaborator Author

Joel: will add proof

@joelagnel

joelagnel commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Failure reproduction proof (before fix)

The Local AI setup-rerun failure incorrectly routed to provider openai and reported that no API key was found. This captures the original symptom. After applying the fix and rerunning setup, the error message disappears and chat works normally.

Local AI request incorrectly reports that no OpenAI API key was found

shanselman added a commit that referenced this pull request Sep 2, 2026
)

Root cause: after 31a8c65/16cb6897 gated screen.snapshot/camera.snap/
location.get behind interactive consent, NodeService.EnsureCaptureConsentAsync
awaited the RecordingConsentDialog's Task<bool> with no timeout anywhere. An
unattended caller (local MCP HTTP client, automated agent, hosted CI) hung
forever waiting for a human who would never appear, only "recovering" when
the caller's own HttpClient.Timeout (30s in the failing integration tests)
fired. This broke McpHttpServerIntegrationTests.CameraSnap_ReturnsImageOr-
WellFormedError and ScreenSnapshot_ReturnsImageOrWellFormedError, blocking
PRs #1282, #1294, #1295, #1296.

Fix: add a fail-closed, configurable consent-prompt timeout
(SettingsData.CaptureConsentTimeoutMs, default 120s) enforced by a new pure
ConsentPromptTimeoutGate helper. On timeout the prompt is denied (never
granted) and the dangling dialog window is force-closed. The bounded task is
independent of any single caller's CancellationToken so the shared in-flight
prompt (_screen/_camera/_locationConsentInFlight) still resolves for any
other concurrent waiter even if the owning caller cancels first. A late
Allow click that races the timeout no longer persists a stale grant after
the request has already been denied. Interactive UI consent (Allow/Deny,
persistence) is unchanged.

- Never bypasses or auto-grants consent: timeout always resolves to denied.
- TrayAppFixture sets CaptureConsentTimeoutMs=3000 for deterministic CI,
  not a test/client timeout change - this is a real product settings knob.
- New unit tests cover fail-closed timeout, pass-through grant/deny, and the
  shared-prompt-survives-caller-cancellation case a rubber-duck review found.

Co-authored-by: Copilot App <[email protected]>
@joelagnel

joelagnel commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

@karkarl @shanselman — for MVP, can we accept the remaining failed-restoration-save case as a bounded recovery risk and treat it as non-blocking?

It requires two consecutive failures: Windows first fails to delete a stale managed identity directory, then persistence of the restored retry record also fails. The original duplicate-routing path and the mixed/protected-record cleanup behavior are covered; Karen's review found no Critical or High defect and described this as a lower-consensus edge-case recovery risk rather than a common-path failure.

Avoiding this case completely would require adding durable transaction/journal machinery to a focused cleanup repair. I would prefer not to add that complexity for MVP unless you consider it necessary.

@joelagnel

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 4db86e3e-e663-4d36-bb8c-18b4d0b75405
@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. and removed merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. labels Sep 3, 2026
@shanselman

Copy link
Copy Markdown
Collaborator

Maintainer decision: accept the remaining failed-restoration-save case as a bounded, non-blocking MVP recovery risk.

The primary invariant is preserved: the durable registry is updated before identity deletion, so it never references an identity already removed. The residual case requires two consecutive filesystem failures, first deleting the identity and then persisting the restored retry record. Setup surfaces that failure rather than reporting success, but recovery may require manual cleanup. Adding a durable journal would materially expand this focused duplicate-routing repair.

Current head a5867d339a4079b137842523d6cb9f1de4944499 has a clean structured review, 8/8 focused cleanup tests, full build and unit suites, and all three hosted Gateway E2E shards passing. Local WSL proof is blocked before cleanup by wsl.exe failing to mount its temporary swap.vhdx with E_ACCESSDENIED; that host failure is recorded as blocked, not passed.

@shanselman shanselman added proof: sufficient Contributor real behavior proof is sufficient. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 3, 2026
@shanselman
shanselman merged commit cff4422 into openclaw:main Sep 3, 2026
21 checks passed
@shanselman shanselman removed the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Sep 3, 2026
larroy pushed a commit to larroy/openclaw-windows-node that referenced this pull request Sep 3, 2026
…enclaw#1300)

Root cause: after 31a8c65/16cb6897 gated screen.snapshot/camera.snap/
location.get behind interactive consent, NodeService.EnsureCaptureConsentAsync
awaited the RecordingConsentDialog's Task<bool> with no timeout anywhere. An
unattended caller (local MCP HTTP client, automated agent, hosted CI) hung
forever waiting for a human who would never appear, only "recovering" when
the caller's own HttpClient.Timeout (30s in the failing integration tests)
fired. This broke McpHttpServerIntegrationTests.CameraSnap_ReturnsImageOr-
WellFormedError and ScreenSnapshot_ReturnsImageOrWellFormedError, blocking
PRs openclaw#1282, openclaw#1294, openclaw#1295, openclaw#1296.

Fix: add a fail-closed, configurable consent-prompt timeout
(SettingsData.CaptureConsentTimeoutMs, default 120s) enforced by a new pure
ConsentPromptTimeoutGate helper. On timeout the prompt is denied (never
granted) and the dangling dialog window is force-closed. The bounded task is
independent of any single caller's CancellationToken so the shared in-flight
prompt (_screen/_camera/_locationConsentInFlight) still resolves for any
other concurrent waiter even if the owning caller cancels first. A late
Allow click that races the timeout no longer persists a stale grant after
the request has already been denied. Interactive UI consent (Allow/Deny,
persistence) is unchanged.

- Never bypasses or auto-grants consent: timeout always resolves to denied.
- TrayAppFixture sets CaptureConsentTimeoutMs=3000 for deterministic CI,
  not a test/client timeout change - this is a real product settings knob.
- New unit tests cover fail-closed timeout, pass-through grant/deny, and the
  shared-prompt-survives-caller-cancellation case a rubber-duck review found.

Co-authored-by: Copilot App <[email protected]>
larroy pushed a commit to larroy/openclaw-windows-node that referenced this pull request Sep 3, 2026
…1282)

Removes all URL-equivalent setup-managed gateway duplicates while preserving protected records and retrying failed identity cleanup.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 4db86e3e-e663-4d36-bb8c-18b4d0b75405
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

local-ai: Needs investigation: intermittent provider-auth/API-key error

3 participants