Add dashboard workspace, sticky sessions, and UI improvements#27
Open
EremesNG wants to merge 33 commits into
Open
Add dashboard workspace, sticky sessions, and UI improvements#27EremesNG wants to merge 33 commits into
EremesNG wants to merge 33 commits into
Conversation
Ensure `rateLimitedUntil` is reset to `undefined` after a successful usage refresh to prevent persisting outdated state. Refs: #main
Refactored `resolveStickyIdentity` and `isCyberPolicyError` into separate modules for better reusability and maintainability. Updated imports and adjusted tests accordingly. Refs: #main
…auth.json Re-authenticating an account wrote fresh tokens to accounts.json but not to ~/.codex/auth.json, so syncCodexAuthFile resurrected the already-consumed (rotated) refresh_token, causing HTTP 401 refresh_token_reused and a persistent authInvalid state. - web: reauth now calls writeCodexAuthForAlias so auth.json receives fresh tokens - codex-auth: syncCodexAuthFile no longer overwrites stored credentials that are newer than auth.json (compares access-token iat, falls back to expiresAt) - auth: dedupe concurrent same-alias refreshToken calls via an in-flight map to avoid one-time-use refresh-token rotation races
…h dedup - web-reauth: asserts reauth writes refreshed credentials via writeCodexAuthForAlias and still updates lastRefresh - codex-auth-sync: asserts stale auth.json tokens do not overwrite newer stored credentials, and newer auth.json tokens still update - auth-refresh-logging: asserts concurrent same-alias refreshes share one request while distinct aliases stay independent
accounts.json was rewritten on every API request to persist history and telemetry (rateLimitHistory, usageCount, rateLimits, etc.). Because saveStore rewrites the whole file via an unlocked read-modify-write snapshot (last-writer-wins), this high-frequency churn risked races and lost updates on real credentials. Move history/telemetry to a new account-metrics.json sidecar with an authoritative in-memory cache, so accounts.json mutates only on real account state changes. - metrics-store: in-memory cache, lazy ensureLoaded(), sidecar path, history derivation (dedup + cap 160), 2s debounced + 30s periodic flush, flush()/ flushSync(), idempotent shutdown flush hooks - store: v2->v3 migration (sidecar-first, idempotent, crash-safe), strip metrics from persisted accounts, loadStoreWithMetrics() merge helper, removeAccount clears metrics - rotation: allocator reads and writes usageCount/lastUsed/lastLimitErrorAt via the cache atomically (no read-cache/write-accounts skew), preserving selection - index/limits-refresh/refresh-queue/codex-auth/auth: split mixed state+metrics writes so metrics go to the cache and accounts.json stays state-only - settings: weighted presets read cache-backed rateLimits - web: /api/state, /api/accounts, recommendAlias serve merged accounts so the dashboard contract is unchanged; flush hooks registered on startup The /api/state and /api/accounts response shapes are unchanged; the frontend is untouched.
The Python auto-login helper wrote lastRefresh, lastSeenAt, usageCount, and rateLimitHistory into accounts.json. Those fields now live in the account-metrics.json sidecar owned by the Node process, so the helper must persist account state only. - remove metric/history writes from the new-account and overwrite paths - add tests/python/test_auto_login_no_metrics.py asserting the four keys are absent from generated accounts.json in both paths (runnable as a script)
Add the accelerated SDD change record for the account metrics split: proposal, phased tasks, and the compliance verification report.
Extended the metrics-store to handle the rateLimitHistory field, ensuring alignment with the sidecar persistence model. Updated related handlers, tests, and interfaces to support history derivation, runtime consumption, and integration API contract changes. Refs: #main
Archived the completed UX redesign proposal, tasks, and verification report under `openspec/changes/archive`. Preserved compliance artifacts and updated related specs to reflect the approved two-section information architecture. Refs: #main
Added new identity sources (`header:x-session-affinity` and `header:session-id`) to the sticky session resolution logic. Enhanced logging with detailed diagnostic inventory for identity resolution to improve traceability and debugging. Updated UI, styles, and tests to accommodate the changes. Refs: #main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces significant architectural improvements, UI enhancements, and build optimizations. Key updates include a transition to a sidecar persistence model for telemetry, a complete restructuring of the dashboard using CSS Grid, and a migration of the build system to PNPM. Additionally, it addresses critical issues regarding token management and data race risks in account metrics.
Changes Included
🏗️ Architecture & Backend
account-metrics.jsonsidecar to reduce data race risks and enhance performance.rateLimitHistoryinmetrics-storeto align with the new sidecar persistence model.accounts.json.🖥️ Dashboard & UI
AccountHistoryChartcomponent, specifically refining the Y-axis behavior and account history visualization.⚙️ Infrastructure & DX
Fixes
auth.jsondata.accountsdata.Documentation & Compliance