Repository navigation
Fix setup-connect E2E pending approval leak - #892
Conversation
External tray setup-connect scenarios can leave delayed device/node approval requests behind in the shared gateway fixture. Later healthy-state assertions then see global pending requests and fail depending on test order/timing. Snapshot pending approvals before each external tray scenario, dispose the external tray before cleanup, and reject only newly-created unhandled requests until the pending state stays quiet. Track requests already approved/rejected by the test body so cleanup does not double-decide them, and keep cleanup failures from masking the original scenario failure. Co-authored-by: Copilot <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed June 29, 2026, 9:32 PM ET / 01:32 UTC. Summary Reproducibility: no. high-confidence local reproduction was established in this review. The current-main source and PR body make the pending-approval leak path plausible, but the contributor's focused E2E attempt was blocked before assertions. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused cleanup after a positive current-head setup-connect E2E run or redacted runtime artifact shows pending approvals remain clear after the external-tray scenarios. Do we have a high-confidence way to reproduce the issue? No high-confidence local reproduction was established in this review. The current-main source and PR body make the pending-approval leak path plausible, but the contributor's focused E2E attempt was blocked before assertions. Is this the best way to solve the issue? Yes, pending proof: cleaning up newly-created pending approvals while preserving AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b4a8d49064a1. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
Summary
Fixes the setup-connect E2E order/race flake by cleaning up pending gateway approval requests created by the external-tray setup scenarios.
The external QR/shared-token tests now:
This preserves the healthy-state checks that require no pending requests; it cleans up the source of the leak instead of weakening
AssertNoPendingRequests.Prior failing job evidence
The flaky GitHub Actions setup-connect shard failed twice after PR #891 was patched in:
OpenClaw.E2ETests.Setup.SetupAndConnectTests.RealGateway_SharedTokenFlow_ReconnectsThroughTrayMcpOpenClaw.E2ETests.Setup.SetupAndConnectTests.RealGateway_BadSharedToken_DoesNotDestroyExistingPairingBoth failures were from
AssertNoPendingRequestsexpecting 0 pending requests and finding 1. The failing log also showed a negative shared-token connect response:and a node list with two Windows node entries, one offline, consistent with an earlier external-tray scenario leaving shared gateway state behind.
Validation
./build.ps1- passeddotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore- passed: 2659 passed, 31 skippeddotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore- passed: 1443 passedInitial
--no-restoretest attempts hit the documented fresh-worktree missing-assets case, so I ran the same test projects once without--no-restoreto restore/build, then reran the required--no-restorecommands above successfully.Real behavior proof
E2ESetupFixture.InitializeAsync()failed because the setup gateway could not become healthy due toEADDRINUSEon the randomly selected gateway port59095inside the local WSL distro:This is a local environment/gateway startup blocker, not a failure in the modified pending-approval cleanup path. CI setup-connect remains the required end-to-end proof for this PR.
Rubber-duck review
A rubber-duck review confirmed the root-cause direction: the reported failures do not create external trays themselves; they observe pending approval state leaked by earlier external-tray tests in the shared fixture. Review feedback led to two hardening changes in this PR: cleanup no longer masks the original scenario failure, and cleanup tracks already handled request IDs to avoid duplicate reject/approve races.