Repository navigation
Conversation
Default rolling logs and their safety fallback now follow the selected state directory, preventing test and separate Gateway instances from contaminating production diagnostics. Existing logging.file overrides remain supported; external collectors must follow the documented new default or use openclaw logs.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@clawsweeper review The final code has a clean independent Codex review, focused logging tests, and a rebuilt two-Gateway isolation/CLI proof. The PR body records the default-path migration, measured qualification cost, and exact-base attribution of the unrelated dead-export failures. |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da47760532
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs maintainer review before merge. What this changesThis PR moves default Gateway logs and their safety fallback into the selected state directory and updates native discovery and documentation. Example: Two Gateways use /srv/openclaw-production and /srv/openclaw-test on November 12, 2026.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current log-isolation defect, and the previous macOS discovery finding is resolved; no actionable introduced bug remains. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe logging transport captures the selected state directory, delegates filesystem preparation and writes to its existing worker, and exposes the resolved file to CLI/RPC readers; the macOS locator discovers structured logs separately. flowchart TD
A[Selected state directory] --> B[Logging transport]
B --> C[Existing logging worker]
C --> D[State-local log files]
D --> E[CLI and RPC log readers]
A --> F[macOS log locator]
D --> F
Technical reviewBest possible solution: Keep log-root selection in the existing file-I/O owner, retain the migrated native reader, and land through the existing CI gates. Do we have a high-confidence way to reproduce the issue? Current-main source routes independent default-profile state directories to the shared temporary log family, and the supplied real-Gateway output demonstrates the repaired isolation; no target code was executed during this review. Is this the best way to solve the issue? The patch is a small, complete owner-level fix: change the existing root selection, preserve worker ordering and explicit paths, and migrate the bundled native reader without introducing another logging owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6c32a15729f2. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +16, Tests +44, Docs +18, Other +92. Total +170 across 21 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
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 HistoryReview history (1 earlier review cycle)
Reviewed November 12, 2026, 7:32 PM ET / November 13, 2026, 00:32 UTC (Revision 2). |
|
Addressed the latest ClawSweeper review on head 74d4ff4:
The PR body now includes the sanitized terminal output from two real simultaneous Gateways and their successful @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74d4ff4dd3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Final review response for unchanged head 74d4ff4:
The previous re-review completed computation but withheld publication because review replies changed its activity cursor. The branch, body, evidence and review responses are now current. Please assess this final head and publish the updated checklist. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* fix(logging): isolate Gateway logs by state directory Default rolling logs and their safety fallback now follow the selected state directory, preventing test and separate Gateway instances from contaminating production diagnostics. Existing logging.file overrides remain supported; external collectors must follow the documented new default or use openclaw logs. * fix(logging): migrate native discovery and bound state creation
Default rolling logs and their safety fallback follow the selected state directory. Preserve explicit logging.file overrides and migrate native log discovery and path documentation. Adapt the stable synchronous path owner and share its existing bounded directory creation helper rather than importing the newer asynchronous file-I/O architecture. (cherry picked from commit 77fcbaa) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes test Gateways and real Gateways with separate state directories appending to the same host-wide daily log, contaminating operator diagnostics.
User Impact
Default logs follow the selected state directory:
logs/, with the existing safe-directory fallback kept inside that same state tree. Harness-created temporary state automatically owns its logs. Explicitlogging.fileoverrides remain unchanged. External file collectors using/tmp/openclaw/must switch to the new path or useopenclaw logs; old logs are not imported. The macOS app now prefers the selected state's structured log (including its safety fallback), preserving separate launchd stdout files, the existingOPENCLAW_LOG_DIRoverride, and discovery of pre-upgrade logs. macOS clawlog reads unified logs and is unaffected.Operator migration note
The default rolling log moves from
/tmp/openclaw/openclaw-YYYY-MM-DD.logto<stateDir>/logs/openclaw-YYYY-MM-DD.log. With the default state directory, the exact path is$HOME/.openclaw/logs/openclaw-YYYY-MM-DD.log; a Linux system service uses the service user's home, for example/home/openclaw/.openclaw/logs/openclaw-YYYY-MM-DD.logwhen that user's home is/home/openclaw.openclaw logsand macOS discovery follow the new location. Any external watcher tailing/tmp/openclaw/openclaw-<date>.logmust switch toopenclaw logsor the new path. Explicitlogging.filesettings are unchanged.Why This Change Was Made
The file-log I/O owner already receives the state directory but previously used it only after shared-temp safety failure. Select it at that owner for normal and fallback paths. No new setting, environment variable, cache, schema, or per-harness convention.
Evidence
Acceptance before measurement: two real Gateway processes must report distinct files through
openclaw logs, contain their own startup record, and contain no sibling startup record. Default-root selection must not scan workspace/session/database contents. Measure five A/A controls and five serial A/B samples of 100 root qualifications on a synthetic 62k-file/1.1-GB workspace with 3k session placeholders and a sparse 35-GiB opaque database placeholder. Report wall time, CPU and exact Node allocation separately from full Gateway behavior. This is an isolation fix, not a performance speedup claim; additional safety-check cost must be reported.The regression fails on base
d30e45c3f48eaa570df1f4528bcc50e7b28e6c77and passes after the fix. All 43 focused logging cases passed; the final 13-case path regression replay passed in 20.40 s wrapper / 13.86 s Vitest. One earlier cold-worker compilation run timed out while the runtime build was also running (17 other cases passed); this is retained as a local validation limitation, not claimed as an inherited product defect. Both runtime builds passed. The final bounded state-creation correction passed 26 tests (two Linux-only deleted-directory cases are skipped on macOS), targeted typecheck and lint. The two real Gateway proof passed again after rebuilding the final correction, and the transport proof reports zero main-thread synchronous filesystem calls, one worker, safe fallback, rollover, reload, refusal, and forced rescue.The initial
pnpm check:changedrun passed every stage except dead exports outside this change. The final run retained those nine failures and also timed out in the unrelated cached x64 Bun staging fixture; its descendant remained in a macOS uninterruptible execution wait after termination. That host cleanup failure remains unresolved, and is not claimed as an inherited product failure. No second fixture or host restart was attempted. Other changed-file stages passed. All nine signatures reproduce in a clean checkout of exact based30e45c3f48eaa570df1f4528bcc50e7b28e6c77:resolveTrustedProxyGitCoauthorwas introduced byf4f290c52f961/ #196867; the eight inline-command UI export signatures were introduced byd90d52cce941c/ #197466. These are newly observed main regressions, not noise; their owners and relevant source inputs are unchanged by this PR. Final independent Codex review is scoped-clean through P2. No changed module is directly imported by Control UI.Per 100 default-root qualifications, five alternating A/B samples:
A/A wall/main/process medians differ 1.3%/0.03%/2.2%; allocation differs 1.2%. No directory/content scans occur in either arm. State-path ancestor qualification adds six
lstatoperations, onestatand onemkdirper preparation. Accepted correctness cost: about 27 µs wall/main CPU, 35 µs process CPU and 10 KB allocation per qualification, retained by the existing transport across ordinary records and date rollover. This is not per-record work. Local Node 26/APFS, host load ~16.6; no btrfs or whole-Gateway performance claim. Synthetic fixtures and both Gateways were cleaned up.Production growth is 16 physical lines: five in the core owner to keep initial and later discovery consistent, and 11 for native discovery across the relocated primary/fallback paths while preserving launchd and pre-upgrade logs. Existing bounded directory creation is reused; no recursive-mkdir retry hazard is introduced. No new owner, cache, schema, production option, or export.
Rebuilt two-Gateway terminal output (temporary root abbreviated; all fixtures synthetic):
{"name":"log-production","file":"<temporary>/openclaw-test-state-log-production-TVxcVM/home/.openclaw/logs/openclaw-2026-11-12.log","port":30000,"cliExit":0,"ownStartup":true,"siblingStartup":false} {"name":"log-test-harness","file":"<temporary>/openclaw-test-state-log-test-harness-sFKjSz/home/.openclaw/logs/openclaw-2026-11-12.log","port":30008,"cliExit":0,"ownStartup":true,"siblingStartup":false}Reproduce after
pnpm build:runtimewithnode --import ./scripts/tsx.mjs scripts/perf/gateway-log-isolation.ts. Both live Gateway processes are read using the realopenclaw logs --jsoncommand. The script verifies the resolved file and startup contents, then cleans both processes and states.Native correction: added a regression covering two selected state directories and state-local safety fallback; existing override/stdout coverage remains. Swift formatting, SwiftLint (435 files, zero violations), and a source compilation of the locator/path owner pass. The ordinary PR planner skips macOS Swift jobs. A sandboxed compiled-source probe therefore exercises the actual
LogLocatorandOpenClawPathsowners, with only the unused default-profile identity supplied by the fixture. It fails on the prior locator and passes on the corrected one for two state directories, safety fallback, existing override and launchd path. Initial custom-sandbox setup attempts aborted; the supported repository sandbox profile plus a physical temporary root succeeded. No full app or native test suite was launched against operator state.Latest-stable upgrade proof used the registry's current stable
2026.11.3, then the rebuilt candidate against the same isolated state and unchanged explicitlogging.filesetting. Both actual Gateway starts and CLI reads passed:The native probe uses
scripts/macos-health-render.sb, denies child forks, and supplies a test-owned HOME/root. Original HOME, preferences/Keychain IPC, shared Keychains, network and filesystem writes outside that root are denied. Its source fixture controls only the default profile stub; selected-state resolution and log enumeration are production code.The later symlink-fallback review concern was reproduced against this exact head and disproved: Foundation's URL-based
contentsOfDirectory(at:includingPropertiesForKeys:options:)returns POSIXENOTDIRfor the primary directory symlink, so the locator selects the active fallback. A path-based enumeration control on that same valid symlink lists the old log. No additional guard was retained.Landing qualification
Final head:
74d4ff4dd364d978af196203556718a98fcfd118. Codex autoreview is clean; the published ClawSweeper review on this head has zero findings/open checklist items, and both code-review threads are resolved.CI run 43335003904, attempt 1, tested merge
c257f03c1b69f2d6dfee88a080c584233e6f6831against main parentbb97be6b37b1fe14fc74a38a904efce340cdef91. The wrapper import-closure failures reproduce on that exact main parent and trace tofc6c25e91564ca1f757d04c5b4676dcab6f66aaa/ #197697, which added a runtime protocol import without updating the wrapper inventory. This is a main regression requiring its owner's repair.The other failure was the fresh-browser HTTP suite's 180-second setup hook, before all three test bodies, with no assertion failure. The saved log was reused. At the maintainer's direction, the exact test was replayed on direct head parent
da4776053295fbe088df07d25584292c1a326787: all three cases passed in 101.20 seconds. That qualifies one scoped hosted retry under the explicit landing instruction; only the failed UI job was requested through the protected job-rerun endpoint. No source change, timeout relaxation or broad CI retry was made. Attempt 2 completed: UI job131608414381passed, security-fast passed, and the only remaining failed job is the inherited wrapper closure (131608417407), with its downstream aggregate131612623668. This qualifies the explicitly authorized pinned-head admin merge; CI is recorded as failed, not relabeled green.The unrelated cached x64 Bun staging fixture's uninterruptible process is left alone as directed. Its earlier timeout/cleanup failure remains an investigated local limitation; it is not claimed fixed or as inherited product behavior.