Add usage-updated hooks for successful refreshes - #3512
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfab5227c5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Codex review: needs real behavior proof before merge. Reviewed September 8, 2026, 2:06 PM ET / 18:06 UTC (Revision 3). ClawSweeper reviewWhat this changesAdds opt-in commands receiving primary and secondary quota snapshots after successful macOS refreshes, with account-scoped throttling, CLI sample events, documentation, and tests. Merge readiness⛔ Blocked before merge - 2 items remain This remains a distinct, useful extension to existing hooks. Both prior correctness findings are addressed; the installed-helper smoke strengthens validation but does not establish the new macOS refresh-to-hook behavior. Priority: P2 Review scores
Verification
How this fits togetherCodexBar refreshes provider usage and publishes account snapshots to its macOS app. Its hook subsystem filters configured rules and sends event data to user-selected local commands. flowchart TD
A[Provider refresh results] --> B[Current successful publication]
B --> C[Primary and secondary quota snapshot]
C --> D[Enabled hook rules]
D --> E[Private account rate limit]
E --> F[Local command with JSON and environment]
Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep snapshot delivery within the existing opt-in hook framework, preserving transition semantics and private account-scoped throttling. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature request; source confirms main lacks successful-refresh hook events, and both previously reported patch defects are addressed. Is this the best way to solve the issue? Yes: extending the existing event and runner infrastructure is a focused solution, and the documented app-only scope avoids changing headless transition behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 928166f89947. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
dfab522 to
89e75d3
Compare
Problem
External hook consumers currently receive quota threshold and provider status transitions, but they cannot evaluate the latest quota headroom after an ordinary refresh. That prevents opt-in automations such as dispatching queued work before an otherwise unused quota window resets.
Change
usage_updatedafter the macOS app publishes a successful, current provider refresh.codexbar hooks watchremains transition-based and does not synthesize this snapshot event.Validation
PATH=/opt/homebrew/bin:$PATH make test— 1,044 selections in 87 groups; 87 first-pass successes, 0 failures, retries, or timeouts.PATH=/opt/homebrew/bin:$PATH make lint— SwiftFormat clean; SwiftLint 0 violations across 2,151 files; repository gates passed.swift test --filter 'ProviderArchitectureGatekeeperTests|CLIHooksTests|HookDispatchTests|UsageUpdatedHookTests'— 62 tests passed.CODEXBAR_SIGNING=adhoc ./Scripts/package_app.sh release— deep signature validation and packaged launch smoke checks passed.Installed-bundle smoke
usage_updatedrules in an existing shared config without replacing other settings.hooks test usage_updated --provider codexinvoked both configured commands successfully. A local redaction command retained only field presence and cadence: primary and secondary usage/reset fields were present, cadence was 300/10080 minutes, and no account field was exported.The installed-helper check uses the representative CLI event; it does not claim a live provider refresh.
Related to #2000, #2001, and #2536.