Avoid unnecessary logging work
Summary
- Avoid evaluating filtered log messages before the active log level check.
- Skip file-log timestamp, metadata formatting, and redaction work while file logging is disabled.
- Add a cheap redaction preflight so ordinary log lines avoid regex passes.
- Add focused regression tests for the logging performance paths.
Verification
swift test --filter CodexBarLoggingPerformanceTestsswiftlint --strict Sources/CodexBarCore/Logging/LogRedactor.swift TestsLinux/CodexBarLoggingPerformanceTests.swiftswift build --build-testsswiftlint --strict
Behavior Proof
Focused logging proof rerun locally on June 16, 2026 PT:
$ swift test --filter CodexBarLoggingPerformanceTests
Build complete! (98.09 sec)
Test run started.
Testing Library Version: 2067.1
Target Platform: arm64e-apple-macos14.0
Suite CodexBarLoggingPerformanceTests started.
Test "filtered log messages are not evaluated" started.
Test "filtered log messages are not evaluated" passed after 0.001 seconds.
Test "disabled file logging does not format metadata" started.
Test "disabled file logging does not format metadata" passed after 0.001 seconds.
Test "redactor leaves ordinary log lines unchanged" started.
Test "redactor leaves ordinary log lines unchanged" passed after 0.001 seconds.
Test "redactor still redacts sensitive log lines" started.
Test "redactor still redacts sensitive log lines" passed after 0.001 seconds.
Suite CodexBarLoggingPerformanceTests passed after 0.003 seconds.
Test run with 4 tests in 1 suite passed after 0.003 seconds.
Notes
- Sparkle was already present in
.build/out/Products/Debug/Sparkle.framework; local test execution needed.build/out/Products/Debug/PackageFrameworks/Sparkle.frameworkto point at it so SwiftPM could load the app test bundle.
Codex review: needs real behavior proof before merge. Reviewed June 18, 2026, 2:55 PM ET / 18:55 UTC.
Summary The PR makes CodexBar logging skip filtered message evaluation, disabled file-log formatting, and low-probability redaction regex work, with focused Linux regression tests and a changelog note.
Reproducibility: yes. Source inspection of current main shows log message autoclosures are evaluated before the configured level guard and file-log metadata is formatted before disabled writes are dropped; tests were not run because this review is read-only.
Review metrics: 2 noteworthy metrics.
- Files changed: 5 files, +135/-12. The diff stays scoped to shared logging/redaction code, one Linux test file, and one changelog entry.
- Focused tests added: 4 tests added. The tests cover the performance-sensitive paths and preserve the sensitive redaction behavior.
Merge readiness Overall: ๐ฆช silver shellfish Proof: ๐ฆช silver shellfish Patch quality: ๐ฆ diamond lobster Result: blocked until real behavior proof is added.
Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.
Rank-up moves:
- [P1] Add redacted real-runtime terminal output or logs showing filtered messages are not evaluated and disabled file logging skips formatting.
Proof guidance:
- [P1] Needs real behavior proof before merge: Missing: the PR body and comments contain only tests/checks; add redacted terminal output or runtime logs from a real CodexBar run showing the optimized logging paths, then update the PR body or ask for re-review.
Risk before merge
- [P1] The latest PR head has only test/check proof, so maintainers do not yet have redacted real-runtime evidence that the lazy logging paths behave as intended in an actual CodexBar run.
Maintainer options:
- Decide the mitigation before merge
Land the narrow logging cleanup after redacted real-runtime proof or an explicit maintainer proof waiver confirms the lazy paths, with the focused checks passing. - Pause or close
Do not merge this PR until maintainers decide whether the risk is worth taking.
Next step before merge
- [P1] No automated code repair is queued because the remaining blocker is real behavior proof or a maintainer waiver, not a patch defect.
Security Cleared: The diff touches redaction internals, but the preflight matches the current sensitive-pattern triggers and adds no dependency, workflow, secret, or supply-chain surface.
Review details
Best possible solution:
Land the narrow logging cleanup after redacted real-runtime proof or an explicit maintainer proof waiver confirms the lazy paths, with the focused checks passing.
Do we have a high-confidence way to reproduce the issue?
Yes. Source inspection of current main shows log message autoclosures are evaluated before the configured level guard and file-log metadata is formatted before disabled writes are dropped; tests were not run because this review is read-only.
Is this the best way to solve the issue?
Yes, with a proof caveat. The patch is narrow, keeps the logging API shape intact, moves enablement checks before expensive work, and adds focused coverage; merge should still wait for real-runtime proof or a maintainer waiver.
AGENTS.md: found and applied where relevant.
Codex review notes: model internal, reasoning high; reviewed against ef2d8ae98e6b.
Label changes
Label justifications:
P3: This is a low-risk internal logging performance cleanup rather than an urgent user-facing regression.rating: ๐ฆช silver shellfish: Overall readiness is ๐ฆช silver shellfish; proof is ๐ฆช silver shellfish and patch quality is ๐ฆ diamond lobster.status: ๐ฃ needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Missing: the PR body and comments contain only tests/checks; add redacted terminal output or runtime logs from a real CodexBar run showing the optimized logging paths, then update the PR body or ask for re-review.
Evidence reviewed
What I checked:
- Repository policy read: AGENTS.md was read fully; its guidance favors focused CLI/parser-style validation and avoiding live provider or keychain checks unless explicitly requested. (
AGENTS.md:1, ef2d8ae98e6b) - Current main evaluates filtered messages: On current main, CodexBarLogger public methods evaluate message() before the guard inside CodexBarLog.logger can discard the level. (
Sources/CodexBarCore/Logging/CodexBarLog.swift:179, ef2d8ae98e6b) - Current main formats disabled file logs: On current main, FileLogHandler.log builds the timestamp, metadata, redacted message, and line text before FileLogSink.write drops disabled writes. (
Sources/CodexBarCore/Logging/FileLogHandler.swift:106, ef2d8ae98e6b) - PR gates message evaluation: At the PR head, CodexBarLogger.log checks isEnabled before evaluating the message autoclosure. (
Sources/CodexBarCore/Logging/CodexBarLog.swift:198, 8c5cdf128ea0) - PR gates disabled file-log formatting: At the PR head, FileLogHandler.log returns before timestamp and metadata rendering when FileLogSink reports file writes disabled. (
Sources/CodexBarCore/Logging/FileLogHandler.swift:111, 8c5cdf128ea0) - Focused tests added: The PR adds tests for filtered message evaluation, disabled file-log metadata formatting, ordinary redaction bypass, and sensitive redaction preservation. (
TestsLinux/CodexBarLoggingPerformanceTests.swift:8, 8c5cdf128ea0)
Likely related people:
- steipete: Current-main blame for CodexBarLog, FileLogHandler, and LogRedactor points to the v0.36.1 integration commit, and steipete also added the PR's changelog note. (role: recent logging area integrator; confidence: high; commits: 06fea2c897cc, 8c5cdf128ea0; files:
Sources/CodexBarCore/Logging/CodexBarLog.swift,Sources/CodexBarCore/Logging/FileLogHandler.swift,Sources/CodexBarCore/Logging/LogRedactor.swift) - Yuxin-Qiao: The redacted MiniMax diagnostic export foundation touched LogRedactor and MiniMax redaction tests, which are adjacent to the PR's redaction preflight behavior. (role: adjacent redaction contributor; confidence: medium; commits: 78c8c0b2bd08; files:
Sources/CodexBarCore/Logging/LogRedactor.swift,Tests/CodexBarTests/MiniMaxLogRedactorTests.swift)
What the crustacean ranks mean
- ๐ฆ challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
- ๐ฆ diamond lobster: very strong readiness with only minor maintainer review expected.
- ๐ platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
- ๐ฆ gold shrimp: useful signal, but proof or patch confidence is still limited.
- ๐ฆช silver shellfish: thin signal; proof, validation, or implementation needs work.
- ๐ง unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
- ๐ off-meta tidepool: rating does not apply to this item.
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
- ClawSweeper keeps one durable marker-backed review comment per issue or PR.
- Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
- A fresh review can be triggered by eligible
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch. - PR/issue authors and users with repository write access can comment
@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only. - Maintainers can also comment
@clawsweeper reviewto request a fresh review only. - Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
- Maintainer-only repair and merge flows require explicit commands such as
@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review. - Maintainers can comment
@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.
๐ฆ๐งน ClawSweeper re-review requested.
I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.
Re-review progress:
- State: Complete
- Detail: The targeted re-review finished, the durable review comment was updated, and the synced verdict was routed.
- Run: https://github.com/openclaw/clawsweeper/actions/runs/27743836080
- Updated: 2026-06-18T08:16:13.388Z
@clawsweeper re-review
Landed as a6965ee0 from exact reviewed head 8c5cdf12.
Maintainer proof:
- Focused logging performance suite: 4 tests passed.
- MiniMax redaction suite: 10 tests passed.
make checkpassed with SwiftFormat clean and zero SwiftLint violations.- Whole-branch Codex autoreview reported no accepted/actionable findings, confidence 0.82.
- GitHub CI passed all four macOS shards, Linux x64, Linux arm64, aggregate lint, legacy aggregate, and GitGuardian checks.
- Review confirmed the lazy redaction prefilter covers every current redaction pattern and the file sink rechecks enablement under serialization.
No live UI proof was needed; this is internal logging work with deterministic performance, redaction, and sink-behavior coverage.