CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

Avoid unnecessary logging work

Open ProspectOre opened this issue 5 months ago โ€ข 4 comments

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 CodexBarLoggingPerformanceTests
  • swiftlint --strict Sources/CodexBarCore/Logging/LogRedactor.swift TestsLinux/CodexBarLoggingPerformanceTests.swift
  • swift build --build-tests
  • swiftlint --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.framework to point at it so SwiftPM could load the app test bundle.

ProspectOre avatar Jun 16 '26 07:06 ProspectOre

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:

  1. 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.
  2. 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:

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-review comments, 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-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to 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 explain to ask for more context, or @clawsweeper stop to stop active automation.

clawsweeper[bot] avatar Jun 16 '26 07:06 clawsweeper[bot]

๐Ÿฆž๐Ÿงน 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[bot] avatar Jun 16 '26 07:06 clawsweeper[bot]

@clawsweeper re-review

ProspectOre avatar Jun 18 '26 06:06 ProspectOre

Landed as a6965ee0 from exact reviewed head 8c5cdf12.

Maintainer proof:

  • Focused logging performance suite: 4 tests passed.
  • MiniMax redaction suite: 10 tests passed.
  • make check passed 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.

steipete avatar Jun 18 '26 20:06 steipete