CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

MiMo: flag a stale local-fallback cache in the summary

Open LeoLin990405 opened this issue 4 months ago • 1 comments

What

Flag a stale MiMo local-fallback cache in the menu summary, so a frozen tracker is not misread as live usage.

Why

The MiMo local fallback (opt-in, added in #1284) reads ~/.codexbar/mimo-local-usage.json, a cache produced by Scripts/mimo-usage.py. CodexBar only reads this cache — it never regenerates it. If the scheduled refresh (launchd/cron/wrapper post-exec) isn't set up or stops running, the cache freezes: the card keeps showing the same Local · … total · … sessions row and an old update time, which reads exactly like a broken refresh (hitting ⌘R changes nothing). In practice a cache can sit frozen for weeks while cc-mimo keeps being used.

Change

MiMoLocalUsageFallback now appends a stale <age> marker (e.g. stale 34d) to the Local · … summary once the cache's updated_at is older than a 12h threshold:

Local · 32.2M total · 520 sessions · stale 34d
  • Fresh caches are unchanged (no marker within 12h).
  • Local accounting is still not rendered as a quota percentage; only the summary text gains the marker.
  • Age is humanized (d/h/m).

Tests / docs

  • swift test --filter MiMoLocalUsageFallback — 7/7 pass, including new flags a cache that has not refreshed within the stale window and does not flag a freshly refreshed cache (deterministic now).
  • swift build clean; changed files pass SwiftFormat.
  • docs/mimo.md documents the marker; CHANGELOG.md (0.41.1) updated.

Backward compatible: only affects the opt-in local source, and only when its cache is already stale.

LeoLin990405 avatar Jul 07 '26 09:07 LeoLin990405

Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 5:52 AM ET / 09:52 UTC.

Summary The PR adds a stale-age marker to MiMo local fallback summaries, preserves compact MiMo summary casing in menu and CLI rendering, adds focused tests, updates MiMo docs, and edits the changelog.

Reproducibility: not applicable. as a bug reproduction: this is a PR feature/UX improvement. Source inspection shows current main lacks the stale marker, and the PR adds deterministic stale/fresh fixture coverage for the new behavior.

Review metrics: 3 noteworthy metrics.

  • Changed files: 8 files affected. The patch spans provider logic, CLI rendering, docs, tests, and release notes, so maintainers should review both UI and CLI output expectations.
  • Focused tests: 3 test files changed. The behavior is covered through fallback, menu projection, and CLI rendering seams rather than live provider or Keychain access.
  • Release-owned file: 1 changelog file modified. Repository policy treats CHANGELOG.md as release-owned, so this file-level change needs cleanup or explicit maintainer ownership before merge.

Merge readiness Overall: 🦪 silver shellfish Proof: 🦪 silver shellfish Patch quality: 🐚 platinum hermit 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-behavior proof showing the stale MiMo local summary in a packaged app, CLI run, terminal output, log, screenshot, recording, or linked artifact.
  • Redact private data such as API keys, non-public paths, endpoints, and account identifiers before posting proof; updating the PR body should trigger a fresh ClawSweeper review.
  • Remove the CHANGELOG.md edit and keep release-note context in the PR body or commit message.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body states that a signed app and CLI were exercised, but it does not include redacted terminal output, logs, screenshots, recording, or a linked artifact showing the stale and fresh fixture behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Contributor real-behavior proof is still insufficient because the PR body only describes a packaged-app and CLI exercise without showing redacted output, logs, screenshots, a recording, or a linked artifact.
  • [P1] The branch still edits release-owned CHANGELOG.md, so release-note context should stay in the PR body or commit message unless a maintainer explicitly owns that file update.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the narrow MiMo stale-marker implementation, remove the release-owned changelog entry, and require redacted proof that the stale marker appears in a real packaged-app or CLI fixture run before merge.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Human review should wait for contributor-supplied real behavior proof and the small changelog cleanup; automation should not try to satisfy the contributor proof gate.

Security Cleared: The diff changes local-cache display logic, CLI formatting, docs, tests, and release-note text without adding dependencies, credential handling, network calls, script execution, or supply-chain surface.

Review findings

  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:16
Review details

Best possible solution:

Keep the narrow MiMo stale-marker implementation, remove the release-owned changelog entry, and require redacted proof that the stale marker appears in a real packaged-app or CLI fixture run before merge.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a bug reproduction: this is a PR feature/UX improvement. Source inspection shows current main lacks the stale marker, and the PR adds deterministic stale/fresh fixture coverage for the new behavior.

Is this the best way to solve the issue?

Yes, mostly: adding the marker inside MiMoLocalUsageFallback and preserving display casing at the projection/rendering seams is narrow and maintainable. The merge-ready branch should remove the changelog edit and include real behavior proof.

Full review comments:

  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:16 This is the same unresolved finding from the prior cycle: repository policy treats CHANGELOG.md as release-owned, so this PR should keep release-note context in the PR body or commit message and let the release flow update the changelog. Confidence: 0.96

Overall correctness: patch is correct Overall confidence: 0.85

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 812e30f62001.

Label changes

Label justifications:

  • P3: This is a low-risk UX clarity improvement for an opt-in MiMo local fallback, with remaining work limited to proof and release-note cleanup.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body states that a signed app and CLI were exercised, but it does not include redacted terminal output, logs, screenshots, recording, or a linked artifact showing the stale and fresh fixture behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

What I checked:

Likely related people:

  • LeoLin990405: The merged opt-in MiMo local fallback that this PR extends was introduced through https://github.com/steipete/CodexBar/pull/1284 and touched the same fallback source, tests, script, and docs. (role: introduced behavior; confidence: high; commits: f5fa8138092d, 2436a3ecdaba; files: Sources/CodexBarCore/Providers/MiMo/MiMoLocalUsageFallback.swift, Tests/CodexBarTests/MiMoLocalUsageFallbackTests.swift, docs/mimo.md)
  • steipete: Recent MiMo fallback hardening and CLI support commits touched the fallback, provider descriptor, CLI path, tests, and docs, and the current PR branch includes owner-side casing reconciliation. (role: recent area contributor; confidence: high; commits: ca5d595e36ed, 44af7b7054c7, 09e7ee3f436f; files: Sources/CodexBarCore/Providers/MiMo/MiMoLocalUsageFallback.swift, Sources/CodexBarCore/Providers/MiMo/MiMoProviderDescriptor.swift, Sources/CodexBarCLI/CLIRenderer.swift)
  • Deb Pramanik: The original Xiaomi MiMo token-plan usage tracking commit introduced the MiMo provider snapshot and adjacent provider tests that this display path builds on. (role: introduced adjacent provider behavior; confidence: medium; commits: f9a2918afcf1; files: Sources/CodexBarCore/Providers/MiMo/MiMoUsageSnapshot.swift, Sources/CodexBarCore/Providers/MiMo/MiMoProviderDescriptor.swift, Tests/CodexBarTests/MiMoProviderTests.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.
Review history (3 earlier review cycles)
  • reviewed 2026-07-07T09:52:15.157Z sha 2ea2f2e97a04b6d7a970a53bb3768793d22a2769 :: needs real behavior proof before merge. :: [P3] Remove the release-owned changelog entry
  • reviewed 2026-07-08T11:19:37.689Z sha 2c3d9eaa7cb3c1717d7e8127d25034fd649a0035 :: needs real behavior proof before merge. :: [P3] Remove the release-owned changelog entry
  • reviewed 2026-07-09T09:47:40.476Z sha 33209ceb3e696c0570f52923098dcb32c3dccc76 :: needs real behavior proof before merge. :: [P3] Remove the release-owned changelog entry

clawsweeper[bot] avatar Jul 07 '26 09:07 clawsweeper[bot]

Maintainer proof for exact head 33209ceb:

  • focused MiMo cache/projection/menu/CLI coverage: 54 tests pass, including the 12-hour freshness boundary, future timestamps, and mtime fallback
  • make check passes; make test passes all 49 local shards
  • exact-branch autoreview: clean, no actionable findings
  • Developer-ID signed debug app verified by codesign and Gatekeeper on macOS 27 build 26A5368g (arm64, SDK 26.5)
  • isolated live stale/fresh cache proof, with no credentials, Keychain reads, or provider network:
    • stale menu and CLI show stale 34d
    • fresh cache removes the marker
    • local-source JSON keeps quota lanes null rather than inventing a percentage
  • independent source-blind behavior validation: 6/6 checks pass
  • dependencies unchanged

Hosted CI is green on Linux, lint, changes, security, and all macOS shards at this exact head.

steipete avatar Jul 09 '26 10:07 steipete