Skip to content

Separate provider polling from passive CLI file refresh - #142

Merged
jaywedgeworth22 merged 39 commits into
mainfrom
codex/independent-source-refresh
Oct 5, 2026
Merged

jaywedgeworth22 merged 39 commits into
mainfrom
codex/independent-source-refresh

Conversation

@jaywedgeworth22

@jaywedgeworth22 jaywedgeworth22 commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Depends on #139. Refs #137 and #136.

Summary

This PR separates active provider quota polling from passive Codex session-file monitoring so each source can run, persist, and be disabled independently. It also adds local quota history charts, measured runaway-usage comparisons, and alert-to-platform navigation.

Functional changes

Independent quota refresh paths

  • Added separate Provider Checks and Codex Session File Checks controls under Settings → Sources & Fleet.
  • Provider checks retain a five-minute default and support 1-, 3-, 5-, and 15-minute intervals.
  • Codex session-file checks default to one minute and support the same intervals.
  • Manual refresh starts both enabled paths. Scheduled provider refresh continues to include provider reads, optional Fleet pull, and quota push; an unchanged file poll does not invoke provider, Fleet, upload, or download work.
  • Disabling a source preserves the other local source when possible. Disabling Read Quotas From This Mac clears local readings, and in-flight results are rejected after a source is disabled or the Codex account changes.
  • Codex readings are merged with provider readings only when they belong to the current account. A newer matching session event can replace a provider placeholder, while stale or cross-account events are ignored.
  • Fleet-only operation no longer reads local Codex identity.

Passive Codex session reading

  • Added a bounded local reader for recent Codex session JSONL files and the current local account identity.
  • Only session metadata and token_count quota events are admitted; unrelated events and quota pools do not produce readings.
  • Events retain their original timestamps, so an unchanged file does not appear to be a new observation.
  • Reads are restricted to recent files and events, use incremental append tracking, reject unsafe paths and symlinks, and clear cached readings when the account changes.
  • The file path is purely passive: it does not start the Codex CLI, contact a provider, pull Fleet data, or push quota data.

Local usage history and runaway comparisons

  • Added per-platform Usage History with 24-hour and 7-day ranges.
  • Each quota window is plotted independently. Gaps, resets, account changes, and allowance recovery are represented as separate line segments, with reset markers.
  • History is shown only when the selected display source has matching local history; Fleet-only or unrelated remote sources do not display a misleading local chart.
  • Added explicit empty, collecting, unavailable, stale, and insufficient-history states.
  • Runaway alerts now include measured percentage-points-per-hour rates, comparison rates, history coverage, and the exact observation time used for the alert.
  • Comparisons use available valid history from the same account and quota period, require meaningful measured coverage, and no longer fabricate a finite multiplier against a zero baseline.
  • Persisted samples now retain account, reset, and quota-period metadata, reject invalid values, deduplicate repeated timestamps, and keep the history file private.

Console and notification navigation

  • Removed the aggregate All Platforms console page and its associated search/layout controls.
  • CodeCaps now opens the current or first available individual platform and falls back to source setup when no platform is available.
  • Added quota history to individual platform pages and the notifications settings.
  • Runaway and reset notifications can route directly to the affected platform and quota window. Recent alert rows and chart markers provide the same navigation.
  • If an alert’s original source is unavailable, the console explains that instead of opening an unrelated platform.
  • Notifications are shown as foreground banners, lists, and with sound.
  • Updated product terminology from Glance to Docked Bar.

Managed settings and validation

  • Infisical refresh now requests only PULL_ENDPOINT, PUSH_ENDPOINT, and SETTINGS_REFRESH_SECONDS by name instead of listing all root secrets.
  • Missing managed keys remain unset; other read failures retain the entire last-known-good settings cache.
  • Invalid saved read tokens are rejected before attempting the corresponding Infisical pull-endpoint write-through.
  • Updated provisioning guidance to recommend project-, environment-, and path-scoped identities with the narrowest supported permissions.
  • Swift CI now serializes work per ref, runs build and tests with native UI fixture rendering, and uploads generated native screenshots as an artifact.
  • Added refresh behavior, source preference, Codex reader, anomaly detection, console navigation, alert routing, settings migration, and screenshot fixture coverage.

Outstanding automated review findings

The provided patch has one critical and five high findings:

  • Critical: Native macOS UI validation wording still permits captured evidence instead of explicitly requiring the mandated code-review-plus-CI workflow.
  • High: Settings-only local state rebuilds can mark a read as complete, causing the console to discard a saved platform selection.
  • High: UsageHistoryView can load and parse the complete sample file during initialization on every SwiftUI re-render.
  • High: Sample appends load and decode the complete history file on the main actor on every refresh.
  • High: A Codex session file first observed before its metadata line is written remains cached as rejected and is not re-evaluated when metadata later appears.
  • High: The paired effort ledger remains out of sync with docs/EFFORT-LOG.md.

@jaywedgeworth22 jaywedgeworth22 changed the title Add account-bound passive Codex quota-file reading Separate provider polling from passive CLI file refresh Oct 4, 2026
@kody-ai

This comment has been minimized.

@jaywedgeworth22
jaywedgeworth22 marked this pull request as ready for review October 4, 2026 17:22
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@jaywedgeworth22
jaywedgeworth22 enabled auto-merge (squash) October 4, 2026 17:22
@jaywedgeworth22

Copy link
Copy Markdown
Collaborator Author

@kody review

@kody-ai

kody-ai Bot commented Oct 4, 2026

Copy link
Copy Markdown

kody code-review Business Logic medium

🤔 Insufficient Task Context

I found a task linked to this PR, but it only contains minimal information (title only, no description or acceptance criteria). To perform a meaningful business rules validation, I need more details.

🔍 What I need to validate:

  • Business requirements and acceptance criteria
  • Expected behavior and business rules
  • Edge cases and constraints to consider

💡 How to improve the task context:

  • Add a description to the linked ticket
  • Include acceptance criteria or business rules
  • Describe the expected behavior after the change

⚠️ Important:

A task title alone is not sufficient to determine whether the implementation is correct or complete.


💡 This validation runs automatically only on the first review of a pull request. To run it again, comment @kody -v business-logic.

Comment thread Sources/CodeCaps/MonitorModel.swift
@jaywedgeworth22

Copy link
Copy Markdown
Collaborator Author

@kody please review

@kody-ai

This comment has been minimized.

The Independent Provider and File Refresh board row lived only in
docs/EFFORT-LOG.md while root EFFORT-LOG.md stayed stale.  Add the same
PR #142 row to both ledgers with current implementation and CI-based
verification wording.

Co-authored-by: Jay Wedgeworth <jaywedgeworth22@users.noreply.github.com>
@kody-ai

This comment has been minimized.

UsageHistoryView init ran on every PlatformDetailPage body evaluation,
including the 30-second clock tick, and called historySamples() each time.
Drop the custom initializer so samples stay empty until reload() runs from
onAppear and lastChecked changes; MonitorModel already memoizes file parses.

Co-authored-by: Jay Wedgeworth <jaywedgeworth22@users.noreply.github.com>
@jaywedgeworth22

Copy link
Copy Markdown
Collaborator Author

Designer UI pass on tip fe4b872. APPROVE.

Settings gained Provider Checks, Provider Check Interval, Codex Session File Checks, and Session File Check Interval. The pickers say Every 1 minute and Every N minutes. Explanatory lines use sentenceGap, a real NBSP then a space. Turning provider checks off gates the refresh. Usage history still loads when the view appears. RECENT USAGE HISTORY matches the other eyebrows. Extra-ship no. Designer is not merging.

State explicitly that the notification screenshot informed design only,
not Mac UI acceptance.  Match the Validation wording Kody requested for
code review plus CI fixtures and iOS simulator screenshots.

Co-authored-by: Jay Wedgeworth <jaywedgeworth22@users.noreply.github.com>
@kody-ai

This comment has been minimized.

@kody-ai

kody-ai Bot commented Oct 5, 2026

Copy link
Copy Markdown

kody code-review Kody Rules medium

Sentence-spacing violation in the PR description leaves only one space between “independently.” and “It,” after “paths.” before “Scheduled,” and after “work.” before “Disabling.” Add a second space after every sentence-ending period to meet the two-literal-space rule.

Kody rule violation: Use two spaces between sentences in every human-facing string and agent-written paragraph

Comment thread EFFORT-LOG.md Outdated
Comment thread Sources/CodeCaps/UsageHistoryViews.swift
@jaywedgeworth22

Copy link
Copy Markdown
Collaborator Author

Designer UI pass on tip 008b5c7. QUIET.

The new commit only edits docs/design/platform-usage-history.md. It rewords the review-evidence paragraph and the Validation section. No product screen, control, label, or user-facing string changes.

Sentence spacing in the new paragraphs holds: two spaces after "PR #134.", "window.", "Mac UI.", and "tests." Existing Title Case headers are untouched. No new buttons, menus, or prices.

The prior Designer pass on fe4b872 was APPROVE and listed no blockers. This diff does not reopen Provider Checks, the interval pickers, or usage-history loading.

@jaywedgeworth22

Copy link
Copy Markdown
Collaborator Author

@kody review

@jaywedgeworth22
jaywedgeworth22 dismissed kody-ai[bot]’s stale review October 5, 2026 19:07

Superseded by fixes and passing CI

…cord

Add explicit init(model:state:row:) to UsageHistoryView to preserve internal
accessibility across files without early computing samples in view init.
Add repo-first pre-work claim record to EFFORT-LOG.md and docs/EFFORT-LOG.md.
@kody-ai

kody-ai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

⚠️ 3 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Use parameterized Prisma SQL only — no interpolated raw queries
  • Keep server secrets out of client bundles
  • Redact sensitive data before logging or sending to Sentry/Datadog
Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@jaywedgeworth22
jaywedgeworth22 merged commit 51c03b4 into main Oct 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants