Repository navigation
fix(setup): enforce one Tailscale probe deadline - #1296
Conversation
Setup Capabilities called ReadToEnd() before WaitForExit(5000), so a hung or pipe-blocked tailscale.exe never reached the timeout. Wait for the child first, drain leftover stdout, and kill the process tree when either step times out. Signed-off-by: Sebastien Tardif <[email protected]>
…lscale-probe-deadline
Use one monotonic deadline for process exit and redirected output drain, with bounded kill cleanup and cancellation-safe task observation. Co-authored-by: Copilot App <[email protected]>
…lscale-probe-deadline
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 5:26 AM ET / 09:26 UTC. ClawSweeper reviewWhat this changesThe PR replaces the setup wizard's unbounded Windows Tailscale status read with a deadline-bound, cancellable process probe and regression coverage. Merge readiness✅ Ready for maintainer review This collaborator PR remains necessary: current main is the unpatched base, while the introduced helper bounds the probe lifecycle and preserves useful status output. The current-head Windows production-entry proof is strong, and no correctness or security finding remains. Priority: P2 Review scores
Verification
How this fits togetherThe setup Capabilities page runs the local Tailscale CLI to determine readiness, then uses its status to update the setup configuration and wizard review. This change controls the CLI process and redirected-output lifecycle before status parsing reaches the UI. flowchart LR
A[Capabilities page] --> B[Tailscale CLI status probe]
B --> C[Deadline and output capture]
C --> D[Status JSON parsing]
D --> E[Setup configuration]
E --> F[Wizard status and review]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Land the bounded process helper with its current regression coverage, retaining the page's cancellation and stale-result guard. Do we have a high-confidence way to reproduce the issue? Yes, at source level. The base implementation reads stdout before reaching its exit wait, and the supplied current-head Windows proof exercises both a hung child and a descendant-held output handle. Is this the best way to solve the issue? Yes. A focused process-lifecycle helper lets the page keep valid early status, bound both wait phases to one deadline, and prevent stale probe results from changing setup state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1d32722cada4. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
Use Process.Exited for immediate-child completion and retain incrementally captured Tailscale status when a descendant keeps the redirected pipe open. Co-authored-by: Copilot App <[email protected]>
|
@clawsweeper re-review Addressed the two P2 findings at 70c433d: immediate exit now uses Process.Exited with the already-exited race covered; ReadAsync preserves parseable status while a descendant retains stdout; and the PR body now includes current-head Windows proof plus the explicit Capabilities-page UI injection blocker. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
) 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]>
…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]>
…lscale-probe-deadline
Co-authored-by: Copilot App <[email protected]> Copilot-Session: e1ae849f-65fd-4424-a93f-461dea53cfde
Replaces #1267 because the contributor fork rejected the required current-
origin/mainmerge through the maintainer OAuth token's missingworkflowscope. This branch preserves the original fix, merges currentmainat1d32722cada43a5515a90599c25ec1b235100566, and completes the deadline repair.What Problem This Solves
The setup Capabilities page could hang while probing
tailscale.exe status --jsonwhen the process did not exit or a descendant retained a redirected output handle.Why This Change Was Made
BoundedProcessOutputapplies one monotonic five-second deadline to immediate process exit and redirected stdout drain. Immediate-child completion usesProcess.Exited, independent of pipe EOF, with an already-exited race check. Incremental stdout capture preserves valid status that arrived before a descendant-held pipe exceeded the remaining drain budget.The landing repair also:
status --json --peers=falseso valid large-tailnet responses cannot be truncated by peer data;ArgumentListrather than a raw command-line string;Required proof pools
none: no custom host class is required. The changed production helper is directly exercised on Windows against a hung child process, an inherited redirected handle, and oversized output. No UI text, layout, permissions, gateway, or installer behavior changed.Validation
Current reviewed head:
aaa891a11c9ee40ad642976fbda7b58015b18923..\build.ps1: passed in 47.0s. Shared, CLI, WinNode CLI, SetupEngine, and WinUI built successfully.dotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj --no-restore: 1,055 passed, 0 failed in 57.5s.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: 3,915 passed, 32 skipped, 0 failed in 28.6s. Skips are the existing environment-gated integration tests.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: 2,840 passed, 0 failed in 37.1s with isolatedOPENCLAW_TRAY_DATA_DIR.python .agents\skills\autoreview\scripts\autoreview --mode local --stream-engine-output: clean, no accepted/actionable findings, overall confidence 0.90.Real behavior proof
The exact production
BoundedProcessOutput.ReadAsyncentry point used byCapabilitiesPagewas exercised on Windows 10.0.26340, win-x64, .NET SDK 10.0.303/runtime 10.0.11:The command passed three consecutive times. The retained-handle regression launches an immediate process that emits valid Tailscale status JSON and exits while a descendant keeps stdout open beyond the remaining drain budget.
ReadAsyncreturns exit code 0, retains the JSON, andTailscaleSetupPolicy.TryParseStatusreports a running backend. The hung-process regression returns at the single deadline and terminates the process tree. The oversized-output regression verifies capture remains bounded.Capabilities page visible proof: Not verified / blocked. This Windows host has no installed Tailscale CLI. No visible copy or layout changed, and direct current-head production-entry proof covers the process-lifecycle behavior without mutating user or machine environment state.
Security Impact
Compatibility and Migration
Backward compatible. No configuration or migration is required.