Skip to content

Add token-protected dashboard snapshots to the CLI server#1026

Open
jethac wants to merge 3 commits into
steipete:mainfrom
jethac:feat/dashboard-server
Open

Add token-protected dashboard snapshots to the CLI server#1026
jethac wants to merge 3 commits into
steipete:mainfrom
jethac:feat/dashboard-server

Conversation

@jethac
Copy link
Copy Markdown

@jethac jethac commented May 18, 2026

Summary

  • Add a typed dashboard snapshot payload for CodexBar provider, session, account, and app state.
  • Extend codexbar serve with a token-protected dashboard snapshot endpoint.
  • Add configurable dashboard identity exposure modes:
    • none: omit account identity fields
    • redacted: redact sensitive identity values while preserving useful account context such as domains/plans
    • full: include full identity values for trusted local/private deployments
  • Document the dashboard API, authentication behavior, CLI flags, identity modes, and example requests.

Rationale

  • This lets CodexBar act as the local source of truth for lightweight dashboard hardware.
  • Low-powered clients can fetch a compact, already-normalized snapshot instead of reimplementing provider probing, account parsing, session tracking, privacy policy, and auth logic themselves.
  • Keeping the aggregation in CodexBar also avoids duplicating sensitive provider/account handling across small devices or local display projects.

Implementation notes

  • Adds dashboard payload models and snapshot aggregation logic.
  • Adds bearer-token authentication for dashboard API requests.
  • Keeps protected dashboard responses unavailable without a valid token.
  • Covers payload construction, identity redaction, routing, auth handling, and endpoint behavior with XCTest.
  • Uses inert placeholder tokens in docs/examples instead of real or secret-looking credentials.

Commands run

  • swift test
    • Passed: 2709 tests
  • make check
    • Passed
    • Runs pinned swiftformat Sources Tests --lint
    • Runs pinned swiftlint --strict
    • SwiftLint result: 0 violations across 918 files
  • git diff --check upstream/main...HEAD
    • Passed

Screenshots/GIFs

  • Not applicable; this is CLI/API behavior with no UI changes.

Reference

  • No linked issue.

Contribution notes

  • No CONTRIBUTING.md or pull request template was found.
  • Followed repository guidance from AGENTS.md.
  • Branch is based on upstream main at d715648c.
  • Published branch contains three scoped commits:
    • docs: add dashboard snapshot API reference
    • feat(cli): add dashboard snapshot payload builder
    • feat(cli): serve token-protected dashboard snapshots

Copy link
Copy Markdown

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

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: 08a598e122

ℹ️ 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 on lines +38 to +41
staleAfterSeconds: max(180, Int(refreshInterval.rounded(.up)) * 3),
host: DashboardHostPayload(
codexBarVersion: codexBarVersion,
refreshIntervalSeconds: max(0, Int(refreshInterval.rounded()))),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject huge refresh intervals before Int conversion

When a user passes a very large but finite --refresh-interval (for example 1e300), decodeServeRefreshInterval accepts it, but the first dashboard snapshot converts it with Int(refreshInterval.rounded(...)); Swift traps on out-of-range Double to Int conversion, killing the server instead of reporting an argument error. Clamp or reject values above the representable range before these conversions.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Noted and fixed!

@jethac jethac force-pushed the feat/dashboard-server branch 2 times, most recently from c914abe to e3165ac Compare May 18, 2026 13:15
@jethac jethac force-pushed the feat/dashboard-server branch from e3165ac to babb10f Compare May 18, 2026 16:56
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.

1 participant