Repository navigation
Add opt-in Codex account and session provider - #14
Conversation
fdussert
left a comment
There was a problem hiding this comment.
Thanks a lot for this — it's a substantial piece of work, and a Codex provider does belong in core (local binary + credentials, widgets in the registry), so the overall direction is right. There is also a lot done well: the provider is fully inert when disabled, symlinks are refused, reads are bounded to sessions//archived_sessions/ with size limits, the child environment is allowlisted, stderr is never relayed, tokens never reach the snapshot, and the deep link is validated twice against the catalog. Before it can land, though, there are some larger changes I'd ask for:
Opt-in mechanism (server/src/codex/config.ts, server/src/index.ts)
Fremkit already has a pattern for opt-in account reads: privacy.claudeAccountUsage in server/src/config/schema.ts, with a migration, a test and a checkbox in ScreenInspector.vue, read on every poll via enabled: () => store.get().privacy.... Please follow it (e.g. privacy.codexAccount plus a history-sources setting) instead of a hand-written data/codex.json and env vars that need a restart, and register the provider in buildApp next to the Claude ones so it's covered by the app tests.
Second app-server and OAuth refresh (server/src/codex/adapter.ts, docs/codex.md)
Spawning a second long-lived codex app-server with the user's credentials is the part I'm most worried about. The docs say incidental token refresh "has not been measured". If refresh tokens are single-use, two processes refreshing concurrently can sign the user out of the desktop app or CLI — the same class of failure we had with Homey (see AGENTS.md). Could you either show that the app-server never refreshes with refreshToken: false, or avoid the long-lived child (one short-lived child per account poll)? Relying on experimentalApi, supportsLunaReserve and explicitGatewayOauth pinned to CLI 0.159.2 also needs a sentence on what happens when they change.
Email on the channel (server/src/providers/codex.ts)
Please drop email from account.data. A quota widget doesn't need it, and claude-account doesn't publish one; plan type and auth mode are enough.
Code style (server/src/codex/observations.ts, parts of providers/codex.ts, test/codex-provider.test.ts)
These files are effectively minified: chained statements, no spacing, any, a 600+ character SQL line. Please format them like the rest of the codebase (one statement per line, named helpers, SQL as a multi-line template). As it stands the security-relevant parts are hard to review properly.
Scope (server/src/codex/projects.ts)
Project grouping (.codex-global-state.json up to 8 MB, legacy project-id migration maps) serves a codex-sessions widget that doesn't exist yet. Could it move to a follow-up PR? A first version with quotas, usage, history and the validated open is much easier to land, and each undocumented Codex file we read is one more thing that can break silently on a Codex update.
Process cost (server/src/codex/observations.ts, server/src/providers/codex.ts)
codex-live spawns two or three sqlite3 processes every 5 s, and each history refresh validates threads one by one, up to 50 sequential sqlite3 runs. Please validate the whole page with one IN (...) query and cache or merge the capability check — a dashboard runs all day. A PRAGMA query_only next to -readonly wouldn't hurt either.
Retry cadence (server/src/providers/codex.ts)
intervalMs drops to 15 s on any error, including unsupported and unconfigured. With no binary on PATH that reruns codex app-server generate-json-schema every 15 s, and an API-key account polls account/read every 15 s forever. Please keep the fast retry for transient errors (offline) and back off for durable ones.
open binary
Please call /usr/bin/open by absolute path, like /usr/bin/sqlite3 elsewhere in this PR.
Docs, changelog, commits
Please add codex and codex-live to the channel list in docs/writing-widgets.md, double-check the learn.chatgpt.com links, and drop the hardware brand mention. The CHANGELOG line should tell a Fremkit user what they get and how to turn it on. Splitting the commit (adapter / account + history provider / live observations) would also match the "small commits" rule in AGENTS.md.
I know that's a long list for a first contribution of this size — happy to discuss any of it, and thanks again for the care that clearly went into the security side.
|
A follow-up on the email point of my review, to give you a clearer rule (the same one applies to the Claude account in #19): Fremkit will get a single privacy setting,
So for this PR: please leave |
e7cce06 to
ab69ee2
Compare
|
Thanks a lot for this rework — it's a substantial rewrite, and it addresses almost everything from the first round. The opt-in now goes through A few remaining items before merging:
Heads-up: we're about to land Thanks again — this is close. |
ab69ee2 to
0329ebd
Compare
a23903b to
3685fdd
Compare
The Codex provider in #14 publishes the account under account.data, and gateAccountEmail only looks at the top level of what it is given, so gating the whole snapshot would leave a nested address in place. The helper stays a single-level one, which keeps it obvious; the contract now says to apply it to the object that carries email, on the fresh, error and stale paths alike, with a nested example and a test that also shows gating the outer object changes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fdussert
left a comment
There was a problem hiding this comment.
Thanks a lot, Florian — every point from the last round is addressed: the 60 s cadence while disabled, the privacy hint and grouped subagent sources, codex/sources.ts so the config no longer pulls in the adapter, the notes on versioned Codex files, and much more readable code. Typecheck and the full suite pass here. Approving. One note on order: #25 (privacy.showAccountEmail) lands first, so this will need a small rebase on the privacy literals; I'll merge right after.
Constrain app-server methods, isolate the child environment, cache schema discovery, and validate local desktop chat IDs in one SQLite query. Co-Authored-By: Claude <noreply@anthropic.com>
Use one read-only SQLite query per poll and bounded verified journal reads. Keep working state explicit when observations become stale. Co-Authored-By: Claude <noreply@anthropic.com>
Expose live privacy controls beside Claude, keep account email private, close each app-server child after its poll, and document the unsupported/runtime boundaries. Co-Authored-By: Claude <noreply@anthropic.com>
Keep unconfigured polling responsive, separate source schema from transport, clarify history exposure, document versioned databases, and improve readability. Co-Authored-By: Claude <noreply@anthropic.com>
3685fdd to
1d1a2c3
Compare
Co-Authored-By: Claude <noreply@anthropic.com>
What this changes
Adds an opt-in, read-only Codex provider for account quotas, token usage and selected local chat history. A separate
codex-livechannel projects observed turn state, model, elapsed time and direct subagents from bounded local records. Opening a chat requires its exact ID in the desktop catalog and validates it again before using the Codex deep link. The provider does not start a Codex child while disabled.The admin privacy settings select account reads and history sources independently. The history setting explains that titles, model and folder or branch labels reach subscribed widgets, including marketplace widgets. Subagent source types are grouped under a disclosure. No account email, credential or conversation body is published. The source enum lives apart from process code so loading configuration cannot start a Codex child.
An unconfigured subscribed channel polls every 60 seconds so an opt-in is picked up promptly.
docs/codex.mddescribes the versioned desktop SQLite schemas and the read-only process boundary. The branch is rebased on the account-email privacy setting in #25 and leaves that setting intact. The user verified the exact-chat deep link on their XENEON setup; this clean branch has not been installed there.The account and sessions widgets are proposed separately to fremkit-sietch.
Checks
pnpm typecheckandpnpm buildpassed at1d1a2c3.test/app.test.tsexcluded locally because its external favicon request timed out in this environment. UI tests: 385 passed.git diff --checkpassed.Latest review pass
Follow-up review: a disabled Codex account clears retained account data before a failed read, and removed history sources cannot be replayed or opened. Added regression tests for both cases and a split JSONL record. Local server and UI suites, typecheck and builds pass.