Skip to content

Fix tracked Codex card refresh - #3189

Open
Zihao-Qi wants to merge 3 commits into
steipete:mainfrom
Zihao-Qi:codex/fix-codex-card-refresh
Open

Fix tracked Codex card refresh#3189
Zihao-Qi wants to merge 3 commits into
steipete:mainfrom
Zihao-Qi:codex/fix-codex-card-refresh

Conversation

@Zihao-Qi

@Zihao-Qi Zihao-Qi commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep an open tracked Codex card eligible for in-place refresh when reset-credit countdowns or pace/detail text change
  • render refreshed values against frozen row geometry so percentages and reset data update without making the menu jump
  • reject refreshes that introduce a metadata row absent from the frozen card
  • let refreshed reset text use the full existing header width instead of the old label width
  • cover the reported 18% to 0% weekly reset while preserving rebuilds for real section-shape changes

Tests

  • make check
  • focused menu refresh/layout suites: 101 tests passed
  • ProviderArchitectureGatekeeperTests: 38 tests passed
  • initial implementation: four clean CI-equivalent make test shards, 930 selections, 0 failed groups, 0 retries, 0 timeouts
  • GitHub CI reruns the full matrix for the revised head

Runtime proof

Not included: reproducing the reported transition requires live provider reset timing. The PR includes deterministic projection, refresh-monitor, and SwiftUI geometry regressions without accessing real account credentials.

Closes #3168

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b277023d51

ℹ️ 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".

Comment thread Sources/CodexBar/MenuCardView+ModelHelpers.swift
Comment thread Sources/CodexBar/MenuCardView.swift Outdated
@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed August 25, 2026, 9:29 AM ET / 13:29 UTC.

ClawSweeper review

What this changes

This PR updates tracked Codex usage cards in place during refreshes, preserving the existing menu-row geometry while publishing new quota, reset-credit, and pace values.

Merge readiness

Blocked until real behavior proof from a real setup is added - 5 items remain

Keep this PR open: it addresses the linked stale-card bug, but two geometry regressions can hide newly refreshed content or truncate a longer reset label.

Priority: P2
Reviewed head: b277023d51be51152bca714911fe7f85f79f1964

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has a focused intent and tests, but two visible rendering defects and missing real behavior proof prevent merge readiness.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: Only deterministic tests and CI claims are supplied; add redacted after-fix runtime evidence showing an already-open Codex card update after refresh, then update the PR body for re-review.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: Only deterministic tests and CI claims are supplied; add redacted after-fix runtime evidence showing an already-open Codex card update after refresh, then update the PR body for re-review.
Evidence reviewed 5 items Metadata compatibility loses newly available text: The compatibility check no longer rejects nil-to-non-nil pace metadata, while the renderer only creates that row when the frozen layout model has metadata.
Reset overlay is width-clipped: The hidden frozen reset label fixes the overlay width and the refreshed label is clipped inside it, so a longer reset string cannot use available row width.
Existing regression test checks only height: The new hosted-card test asserts unchanged height but does not assert that newly added metadata or a longer reset label is visible.
Findings 2 actionable findings [P2] Keep newly added metric metadata incompatible
[P2] Avoid clipping longer refreshed reset labels
Security None None.

Live Verification

Command: swift test --filter CodexResetCreditsMenuCardTests

Result: FAIL (failed) — execution before step 1 run: sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.23.0.tgz

sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.23.0.tgz

Assertions:

  • FAIL expect_output: CodexResetCreditsMenuCardTests

How this fits together

CodexBar resolves provider usage snapshots into SwiftUI menu cards. While a macOS menu is tracked, the refresh monitor can publish a compatible live model into existing rows instead of rebuilding the menu.

flowchart LR
A[Codex usage snapshot] --> B[Refresh monitor]
B --> C{Tracked layout compatible?}
C -->|Yes| D[Live card model]
C -->|No| E[Rebuild menu rows]
D --> F[SwiftUI usage card]
E --> F
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: Only deterministic tests and CI claims are supplied; add redacted after-fix runtime evidence showing an already-open Codex card update after refresh, then update the PR body for re-review.
  • Keep newly added metric metadata incompatible (P2) - A refresh that changes detailLeftText or detailRightText from absent to present now passes compatibility, but MetricRow creates the metadata row only when the frozen layout has metaText. The new pace/detail value is therefore never rendered while this tracked card stays open. Reject that nil-to-non-nil transition or reserve the row before publishing it.
  • Avoid clipping longer refreshed reset labels (P2) - The hidden frozen reset label establishes the overlay's fixed intrinsic width, then .clipped() truncates a longer resolved label. A reset changing from a short countdown to a longer one will display incomplete text even where the row could select its stacked layout. Size the layout from the refreshed label or reserve a stable maximum-width container.
  • Resolve merge risk (P1) - Merging can leave newly available pace/detail text invisible until the menu closes, or show a clipped reset countdown when the refreshed value is longer than the frozen value.
  • Complete next step (P2) - The two blockers are narrow renderer and regression-test repairs; contributor runtime proof remains required after the code repair.

Findings

  • [P2] Keep newly added metric metadata incompatible — Sources/CodexBar/MenuCardView+ModelHelpers.swift:438-445
  • [P2] Avoid clipping longer refreshed reset labels — Sources/CodexBar/MenuCardView.swift:645-653
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production +70/-19, tests +136/-34 across 6 files The implementation is focused, but its shared renderer changes need visibility regressions covered in addition to height checks.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #3168
Summary: This PR is an explicit candidate fix for the reported Codex tracked-card refresh defect.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Repair frozen-geometry rendering (recommended)
    Keep updates in place only when new metadata can render visibly and make longer reset labels choose an unclipped layout.

Technical review

Best possible solution:

Preserve stable menu height while ensuring every refreshed value is visible: rebuild for newly introduced metadata or reserve its row, and size reset-label geometry for the refreshed text or a safe width bound.

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

Yes—source inspection gives a high-confidence path: refresh from absent to present metric metadata, or from a short to longer reset label, while the card remains tracked.

Is this the best way to solve the issue?

No—the in-place strategy is appropriate, but the proposed frozen geometry does not preserve visibility for all compatible refreshed values.

Full review comments:

  • [P2] Keep newly added metric metadata incompatible — Sources/CodexBar/MenuCardView+ModelHelpers.swift:438-445
    A refresh that changes detailLeftText or detailRightText from absent to present now passes compatibility, but MetricRow creates the metadata row only when the frozen layout has metaText. The new pace/detail value is therefore never rendered while this tracked card stays open. Reject that nil-to-non-nil transition or reserve the row before publishing it.
    Confidence: 0.99
  • [P2] Avoid clipping longer refreshed reset labels — Sources/CodexBar/MenuCardView.swift:645-653
    The hidden frozen reset label establishes the overlay's fixed intrinsic width, then .clipped() truncates a longer resolved label. A reset changing from a short countdown to a longer one will display incomplete text even where the row could select its stacked layout. Size the layout from the refreshed label or reserve a stable maximum-width container.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The PR repairs stale visible Codex usage data but does not indicate an availability or security emergency.
  • add merge-risk: 🚨 other: Shared tracked-card geometry can suppress or truncate refreshed user-visible text despite passing model-level tests.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Only deterministic tests and CI claims are supplied; add redacted after-fix runtime evidence showing an already-open Codex card update after refresh, then update the PR body for re-review.

Label justifications:

  • P2: The PR repairs stale visible Codex usage data but does not indicate an availability or security emergency.
  • merge-risk: 🚨 other: Shared tracked-card geometry can suppress or truncate refreshed user-visible text despite passing model-level tests.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Only deterministic tests and CI claims are supplied; add redacted after-fix runtime evidence showing an already-open Codex card update after refresh, then update the PR body for re-review.

Evidence

Acceptance criteria:

  • [P1] swift test --filter CodexResetCreditsMenuCardTests.
  • [P1] make check.

What I checked:

Likely related people:

  • Yuxin Qiao: Recent history includes the refresh-monitor update and fixes for long reset-label rendering. (role: recent refresh and layout contributor; confidence: high; commits: 648a948b7ab4, bff43f8a2cc7, d91fcea54609; files: Sources/CodexBar/MenuCardRefreshMonitor.swift, Sources/CodexBar/MenuCardView.swift)
  • Peter Steinberger: Git shortlog shows the largest contribution history across the touched menu-card and refresh surfaces. (role: major menu-card history contributor; confidence: high; commits: 15a855a2132a, b40c3537c65d; files: Sources/CodexBar/MenuCardView.swift, Sources/CodexBar/MenuCardRefreshMonitor.swift)
  • Zihao-Qi: Prior merged history includes manual-refresh quota display work in this refresh subsystem. (role: earlier manual-refresh contributor; confidence: medium; commits: 13616b0d442f; files: Sources/CodexBar/MenuCardRefreshMonitor.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Repair both frozen-geometry visibility cases and add focused regressions.
  • Add a redacted after-fix menu capture or runtime accessibility output showing the visible refresh.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@Zihao-Qi

Copy link
Copy Markdown
Contributor Author

Addressed both review findings in 1d01763 and resolved the inline threads. Local validation: 101 focused refresh/layout tests, 38 architecture gatekeeper tests, and make check all pass.

@codex review
@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 1d0176343a

ℹ️ 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".

Co-authored-by: Trim <womayeyonggugele@gmail.com>

@steipete steipete left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed reset-card updates, metadata layout stability, hidden-account and workspace isolation, focused regressions, and architecture guardrails.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown

ClawSweeper status: review started.

I am starting a fresh review of this pull request: Fix tracked Codex card refresh This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex card keeps rendering pre-reset snapshot after backend weekly reset; only re-clicking the active tab repaints it (⌘R doesn't)

2 participants