Repository navigation
fix: keep cancellation diagnostics when setup closes - #1980
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR retains the native setup log file until the active setup operation finishes, including cancellation cleanup after page unload. Example: Native setup is cancelled and its page unloads before cleanup logs "Native Gateway setup cancelled."
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this collaborator-authored draft open: current main still closes the log before asynchronous cancellation cleanup finishes, and no actionable introduced defect was found. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe native setup page passes SetupLogger to setup hosts, command execution, and runtime adapters; sanitized diagnostic entries leave through the existing JSONL file, console, and subscribers. flowchart TD
A[Native setup page] --> B[Operation lease]
A --> C[Setup hosts and runtime]
C --> D[SetupLogger]
B --> D
D --> E[Existing JSONL file]
D --> F[Console and subscribers]
Technical reviewBest possible solution: Keep file lifetime in SetupLogger and retain it around the existing native setup operation without changing cancellation, rollback, or later-stage ownership. Do we have a high-confidence way to reproduce the issue? Source shows unload requesting disposal before awaited cleanup completes, after which main drops file writes; this review did not execute a runtime reproduction. Is this the best way to solve the issue? The defect is premature sink closure, the invariant is that active-operation cleanup remains writable, and the smallest complete fix is a scoped retention lease in the existing logger acquired before the page's first await. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2ff4d168588d. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 2, 2026, 4:13 PM ET / 21:13 UTC. |
0cb9b22 to
f4c1208
Compare
ea74184 to
35cddee
Compare
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Synchronize cross-thread activation and allow a bounded foreground handoff while retaining exact window and pointer ownership checks. Co-authored-by: Copilot App <[email protected]>
35cddee to
1c5fe00
Compare
Related: #1978 (fix(setup): record terminal state when commands are cancelled)
What Problem This Solves
Fixes missing native Gateway setup cleanup diagnostics when the setup page
closes while an operation is being cancelled.
User Impact
When the setup log file is available, cancellation cleanup can continue recording
to it until the current native setup operation finishes. A failed or unavailable
file sink remains memory-only. This does not fix a Gateway startup or validator
stall and does not guarantee logs after navigation to later setup stages.
Why This Change Was Made
The page can request logger disposal before asynchronous cancellation cleanup
has finished. An operation-scoped lease defers file-sink closure until that
operation releases it, without changing cancellation or rollback behavior.
Evidence
An isolated file-sink regression observed cancellation cleanup after disposal
was requested, and a separate regression covered multiple and idempotent
leases. A page source guard checks acquisition before the first await. Native
page cancellation and diagnostics-bundle inclusion have not been exercised.
Before the commit, an independent Copilot rubber-duck review reported a
retry/lease race, but the proposed interleaving is inconsistent with the page's
busy guard and lease counter. Several other review statements were inaccurate,
so the full-scope source-review assessment remains incomplete.
Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: exercise current-head native setup cancellation,page teardown, and the retained diagnostics state.
windows-11-arm64: the reported native setup scenario is on ARM64 and needscurrent-head runtime proof.
Validation
The following ran before the commit on the source identified below, with
isolated tray directories and a process-scoped PowerShell execution policy. The
committed diff matches that tested source.
$dirwas a fresh private resultdirectory for each suite.
pwsh -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -File .\build.ps1: passed, Debugwin-arm64.dotnet test ".\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj" --no-restore --logger "trx;LogFileName=Shared.trx" --results-directory "$dir" --verbosity normal: 4,808 passed, 24 skipped.dotnet test ".\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj" --no-restore --logger "trx;LogFileName=Tray.trx" --results-directory "$dir" --verbosity normal: 4,754 passed.dotnet test ".\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj" --no-restore --logger "trx;LogFileName=SetupEngine.trx" --results-directory "$dir" --verbosity normal: 2,486 passed, 1 skipped.git diff --check: passed.The tests ran under
pwsh -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Commandand produced fresh TRX files. These are notinventory-bound proof-pool executions.
Real Behavior Proof
1912df7e2f976314d82baa88a5decf31218b33a1plus uncommitted diff blobc43a6f49479b359977a58e5d8afed4aac8e2c433; that diff matches commit0544f7b27ba4afac11e9ac8be1a76a8cdc068875.OperationLeaseKeepsFileOpenThroughCancellationCleanupin the full SetupEngine suite above.Yes/No/N/A): N/A.Security Impact
Yes/No): No.Yes/No): No; the existing sanitization remains in use.Yes/No): No.Yes/No): No.Yes/No): Yes; already-generated cleanup entries can now reach the existing setup log file after page unload.Yes, explain the risk and mitigation: The extended file retention may include additional diagnostic entries, including command output or exception fields already logged by existing code. It uses the same sanitization, location, and file-sink failure behavior and creates no new sink. Sanitization does not guarantee removal of arbitrary user content.Compatibility and Migration
Yes/No): Yes, except for the intended retention of cleanup entries.Yes/No): No.Yes/No): No.Review Conversations