Repository navigation
feat(setup): stream live native Gateway activity log and typed failure diagnosis - #1735
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 adds a live native Gateway setup activity panel, persistent setup logging, and typed failure details. Example: The native Gateway remains starting until the three-minute startup deadline.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this collaborator-authored PR provides useful native setup diagnostics absent from main, and source review found no definite introduced defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe setup page calls the existing native setup service and package runtime; lifecycle events and command results flow through SetupLogger into local diagnostics and the activity panel. flowchart TD
A[Native setup page] --> B[Native setup service]
B --> C[Package client and runtime]
C --> D[Package qualified clawctl]
C --> E[SetupLogger]
E --> F[Activity panel]
E --> G[Local JSONL log]
Technical reviewBest possible solution: Keep the existing setup and package owners, with one window-scoped logger supplying sanitized activity and failure diagnostics. Do we have a high-confidence way to reproduce the issue? Current-main source confirms the limited status display and fileless native setup logging; no target code was executed during this read-only review. Is this the best way to solve the issue? The implementation extends the shared package client and existing logger, reuses the established log launcher, and keeps lifecycle and authorization decisions with their current owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 846ba0e9ddba. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
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 October 15, 2026, 3:06 AM ET / 07:06 UTC. |
Global repo triage adversarial reviewDecision: Both independent reviewers completed against exact head
Required next action: make log-sink failures non-fatal, stream bounded sanitized stderr while preserving stdout credential isolation, report the actual failing listener, restore failure UI coverage, remove locale residue, and provide current-head No code changes or remote branch updates were made by this review. |
be651c9 to
2c9f1c8
Compare
|
Looks good overall to me. Have we seen how much logging this generates? I haven't looked at the log levels but if you could take a look and confirm; high frequency log spew should be kept at non default log levels. It would be good to also have detailed logging for the setup flow as that seems flaky right now (especially with native gateway) |
Hanselman review: #1735 (feat(setup): stream live native Gateway activity log and typed failure diagnosis)Decision: HOLD_FOR_AUTHOR. Take confidence: 60%. Recommendation confidence: 95%. Code review is complete; merge readiness is not. Reviewed head Independent models: HIGH consensusAgreement is about the defect, not necessarily severity.
LOW consensus
Restore equivalent coverage around NativeGatewaySetupUxContractTests.cs:132-139. Remove bare Disputed/rejected rationale: Package stderr is buffered until completion and lost on cancellation, but that loss predates this PR. The new logger events are live. Unlike the predecessor review, this review does not classify it as a new MEDIUM regression or require raw stdout streaming. Bounded sanitized stderr retention remains useful follow-up. Arbitrary readiness-reason leakage was rejected against the pinned packaging producer's fixed enum mapping. No credential leak or authorization bypass was established. Debug is not opt-in in the tray logger; nominal Debug labels alone do not prove low default log volume. Inspected validation, not locally executed: exact-head CI run 38983841532 succeeded. Downloaded TRX reports show Shared 4,385 passed, Tray 4,090, Connection 1,658 and SetupEngine 2,349, with zero failures. All 114 cases in the five affected test classes passed. No local build, test run, application or Gateway was launched for this review. Missing proof: Next action: author fixes the two verified behavioral defects, restores failure coverage, removes locale residue and supplies current-head native proof. Maintainer then revalidates the changed head. No source, branch, GitHub or shared-runtime changes were made by this review. |
2c9f1c8 to
661fd2d
Compare
90d0c3c to
4e62241
Compare
…e diagnosis The native Gateway setup page previously showed a single status line and only ex.Message on failure, while all native setup logging went to throwaway SetupLogger instances and clawctl stderr was discarded. - SetupLogger is now safe to write after Dispose, and the IOpenClawLogger adapter takes a configurable prefix instead of hard-coded "[WS] ". - NativeGatewayPackageClient captures stderr, logs every clawctl call with exit code and sanitized stderr tail (never stdout, which carries the Gateway token), and names the failing command and exit code in parse errors without leaking stderr into user-facing messages. - IsolatedGatewayRuntime logs lifecycle transitions (status summaries, start/stop, listener verification, rollback) and carries the last IsolatedGatewayStatus on startup timeout; unknown-listener details now name the squatting process without claiming its PID identity. - New NativeGatewaySetupDiagnostics renders sanitized typed failure facts (port/verdict, last status, Win32 error code, error type), and the ownership failure now includes the provenance detail it previously dropped. - The setup window owns a window-scoped native setup log at %APPDATA%\OpenClawTray\Logs\Setup\native-setup-*.jsonl, and the page gets a "Detailed activity" expander with live lines, an "Open log file" link, and a failure InfoBar that names the failed row and opens the expander automatically. Resources added in all six locales.
The rebase left a bare ======= merge-marker line between Onboarding_Native_Preview and Onboarding_Native_Activity.Header in the fr-fr, nl-nl, pt-br, zh-cn and zh-tw Resources.resw files. The files still parsed as XML because the line is a stray text node under <root>, so existing localization tests did not catch it. - Delete the five stray marker lines. Key parity with en-us is unchanged. - Add LocalizationValidationTests.NoLocale_HasStrayTextOutsideResourceElements, which fails when a locale resw carries non-whitespace text directly under the root element.
The rebase merged two failure surfaces on the native Gateway setup page and both kept a way to open the same log file: the recovery panel's "View setup log" button and the activity expander's "Open log file" link. Keep the expander link, which sits next to the log text it opens. - Remove ViewLogButton from the recovery panel and its ViewLog_Click handler. - ShowRecovery keeps the panel visible when no log file exists by checking _log?.FilePath directly instead of the deleted button's visibility. - Remove Onboarding_Native_ViewLog.Content from all six locales.
InspectSnapshot checks every listener on the verified port but always reported listeners[0] in the ownership-failure detail. With an attested IPv4 listener beside an unverified IPv6 listener, the error blamed the legitimate Gateway instead of the listener that actually failed. - Report the first listener that fails the ownership check. - Add a mixed-listeners test asserting the failing listener is named and the verified one is not blamed. Authorization still fails closed.
4e62241 to
2e3b967
Compare
Summary
Native Gateway setup currently fails with little to go on: a step turns red and a single message appears. This PR shows the user what setup is doing while it runs, and gives a structured explanation when it fails.
What changes for the user
clawctlcommands and their exit codes, Gateway status changes, listener verification). It keeps the last 300 lines and has an "Open log file" link.OPENCLAW_SETUP_PREVIEW_PAGE=native-failedrenders the failure state without a real Gateway.How it works
SetupWindow.NativeSetupLogowns the log (Logs/Setup/native-setup-*.jsonl). The page attaches to it and the setup host writes into it, so retries and helper processes all land in the same file. The page no longer creates or disposes its own log.clawctllogging.NativeGatewayPackageClientaccepts anIOpenClawLoggerand logs each command, its exit code and duration. On failure it also logs the end of stderr, with secrets removed. Stderr is kept out of exception messages, because the tray displays those.IsolatedGatewayRuntimelogs status reads, pre-start port conflicts (naming the process holding the port, without claiming it is the Gateway), start, restart, stop, configuration repair, and listener verification.NativeGatewaySetupDiagnostics.Describe(Exception)turns typed exceptions into display-safe lines, with every line cleaned up. It also handlesAggregateException.SetupLoggerignores writes after it is disposed, because the runtime and host can outlive the page.Rebase onto main (#1787, #1918)
Main's startup timeout handling is kept as is: the phase and time-limit fields on the timeout error, the
OPENCLAW_NATIVE_GATEWAY_START_TIMEOUToverride, the status text format, the file-write failure handling and the recovery panel. This PR builds on them instead of its earlier versions. The timeout error's constructor is now public so the preview can create one. The validation numbers below predate the rebase. After the rebase:dotnet build(ARM64) succeeded. SetupEngine tests 2489 passed, 0 failed. Shared tests 4808 passed, 0 failed. Tray tests 4762 passed, 1 failed (BuildPrerequisiteTests.CheckOnly_UsesTheAppLocalRuntimeResolver). Connection tests 1699 passed, 3 failed (migration and PowerShell checker tests). The 4 failures are in code this PR does not touch and look like environment problems on the test machine. They have not been checked against a clean main../build.ps1stopped at its documentation check because of unrelated untracked local files.Required proof pools
windows-setup-ui(tray UX / setup wizard surface)gateway-connection(IsolatedGatewayRuntime lifecycle logging, ownership detail)Validation
Run on the rebased head (origin/main at 2dd1a64 + this PR):
./build.ps1- all builds succeeded. Docs gate required parking a pre-existing untracked file (docs/implementation/native-gateway-slow-start-fix.md, Mermaid + broken anchors, unrelated to this PR) outside the tree during validation; restored afterward.dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore- 4312 passed, 0 faileddotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore- 4077 passed, 0 failed (OPENCLAW_REPO_ROOTset)dotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj --no-restore- 1584 passed, 0 faileddotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj --no-restore- 2336 passed, 0 failedReal behavior proof
native-faileddeterministic preview (OPENCLAW_SETUP_PREVIEW_PAGE=native-failed,OPENCLAW_FORCE_ONBOARDING=1, isolated data dir, Debug build):ExpandCollapseState: Expanded; AutomationIdNativeGatewaySetupActivityfound).Proof capture: the interactive transcript shows the expanded page with the InfoBar above the auto-opened "Detailed activity" expander and the "Open log file" link.
Not verified / blocked
clawctl setup,Starting the package-managed Gateway on port N.,Gateway status after ...,Verified the Gateway listener ...): not exercised on this host because no MXC/isolation-capable package Gateway is installed here. The same pipeline is proven by the native-failed preview, the unit tests (stderr tail,Gateway status after, squatter detail, LastStatus), and the recycled ProgressPage pattern.clawctlcommand exists for reading the package Gateway's own process logs (setup,status,companion prepare,gateway-service start/status/restart/stoponly); adding a package-log command would be a follow-up inopenclaw-windows-packaging.