You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🐛 Sessions: a session's Codex/OpenCode login copy can still refresh and diverge from the shared login (follow-up to #18793) #18740
Follow-up to #18724. User sessions get a copy of the hive's shared login file for several vendor CLIs. For Claude, #18728 stops a session from holding a refreshable login and adopts a newer login found in a session HOME back into the shared file. Two other vendors store a rotating refresh token in the copied file and can still split from the shared login the same way.
An API-key login in either exposed file does not rotate and is not affected.
What can happen
The CLI in a session refreshes its copy. The refresh rotates the refresh token, so the session's copy becomes the only valid login and the shared file the agents use is stale. Agents on that backend then fail to refresh and end at a login prompt until someone signs in again. Deleting the session deletes the only valid login.
Only one thing: a session start or resume no longer overwrites a login file the session's CLI rewrote after the shared file was written. There is no adopt-back and no refresh-less copy for these vendors.
What is wanted
For each exposed vendor, the same guarantees #18724 lists for Claude:
a refresh inside a session never leaves the shared login stale;
deleting or ending a session never destroys the only valid login;
two holders never refresh concurrently into divergent tokens;
no credential contents are logged.
Options, per vendor:
Adopt-back. When a session HOME holds a strictly newer valid login than the shared file, adopt it into the shared file atomically with an audit entry, decided by the file's own freshness fields and modification time only. Codex records a last-refresh time in its file; OpenCode records an expiry per provider entry.
A copy that cannot refresh, where the CLI accepts one. This needs checking against each CLI: Codex may reject a login file with no refresh token.
Start from src/crux/agent/usersession_login.go and userSessionLoginFiles in src/crux/agent/usersession_home.go. Check first how agents share each of these files (Codex agents link to the shared file; see src/crux/agent/manager_homes.go), because the right single owner differs per vendor.
Constraints
Tests use synthetic credentials only.
Never log, print or audit credential file contents.
Update src/docs/security-model.md (the sessions section already names these two vendors as exposed).
PR #18793 has merged (#18793) and referenced this issue with a non-closing Refs #18740 rather than a closing keyword.
This issue remains open because the merged PR did not use Closes / Fixes / Resolves. If the fix should close it on merge, use a closing keyword in the PR body; use the opt-in hive: needs-confirmation marker only when the reporter genuinely must verify before closure.
Commit SHAs for the sweep: the adopt-back half of this issue landed in #18793 (80ec755); current v5 head is 6b79bed19.
Remaining scope, which is what is still open here:
A session's own copy of a Codex or OpenCode login can still refresh independently (option 2 in the description): make the session copy non-refreshing, or otherwise stop a session refresh and an agent refresh in the same window from diverging.
Verify the assumed Codex and OpenCode auth file formats against live installs, and add a test fixture from a real file.
Confirm src/docs/security-model.md covers the adopt-back (stale-file retention and audit entry) and that no credential value is ever logged.
changed the title [-]🐛 Sessions: Codex and OpenCode OAuth logins can still split from the shared login when a session refreshes them[/-][+]🐛 Sessions: a session's Codex/OpenCode login copy can still refresh and diverge from the shared login (follow-up to #18793)[/+]on Nov 18, 2026
@clubanderson this reads as a partial or uncertain confirmation, so the issue stays open. If it is fully fixed for you, reply /fixed to close it; otherwise please describe what is still outstanding.
Claimed. Remaining scope being worked: make a session's own Codex/OpenCode login copy unable to refresh independently of the shared login (option 2), plus the security-model docs check. The live-install check against real Codex and OpenCode files needs a person and stays open on this issue.
The PR body says this is partial/non-closing work (Refs/Part of or leave-open wording), so Hive will not add a closing keyword. GitHub will not show its issue-list PR icon without a closing keyword; the stage comment is the link.
Scanner verification of #18793: option 1 (adopt-back for Codex and OpenCode, with a kept stale copy and an audit entry) is merged and covers 'never leaves the shared login stale', 'deleting a session cannot destroy the only valid login' and 'no credential contents logged'. What remains is the 'two holders never refresh concurrently' guarantee: #18793 did not do option 2 (a copy that cannot refresh), because whether Codex or OpenCode accept a login file without a refresh token can only be checked by running each CLI. Leaving the issue open for that check. No implementation started.
Update on this issue from reading the public sources of Codex 0.170.0 (the version src/Dockerfile pins) and OpenCode v1.19.6 and v2.3.2. No live install was touched.
Both CLIs require the refresh token key but accept an empty value. Codex: tokens.refresh_token is a plain String (token_data.rs:22); with auth_modechatgptAuthTokens it is never refreshed (manager.rs:3578, 3660), and with chatgpt a failed refresh is only logged. OpenCode v1: refresh is a required string (auth/index.ts:16) and an oauth entry with an empty refresh just fails after expires (codex.ts:145). So a refresh-less session copy (option 2) looks feasible for both: medium confidence for Codex (an undocumented file path), high for the OpenCode v1 file. It needs the session copy re-synced before the access token expires.
A bigger concern: session copies are written mode 0400. Both CLIs refuse to overwrite them, but only after the refresh exchange, so a session refresh could rotate the shared token and save the new one nowhere. Adopt-back would then never fire for these two vendors. The live check needs to confirm this.
Neither CLI holds a cross-process lock around the refresh exchange (Codex's auth.lock covers only the commit and is per CODEX_HOME), so "never refresh concurrently" cannot be promised from outside. What holds: no torn file, no silent overwrite (Codex), and a safe failure for the loser.
OpenCode v2 stores logins in SQLite and reads auth.json once, so the file logic here does not apply to it.
Step 2 of the live check in security-model.md needs correcting: editing last_refresh and codex login status do not force a refresh.
A read-only runbook with a tested redaction command is ready, and a fixture and tests are on a local branch. This stays open until the live check is done and the session-copy behavior in item 2 is decided.
@clubanderson this reads as a partial or uncertain confirmation, so the issue stays open. If it is fully fixed for you, reply /fixed to close it; otherwise please describe what is still outstanding.
PR #19117 implements option 2: Codex and OpenCode session copies keep the refresh key with an empty value (like the Claude copy), the hive keeps each copy following the shared login, and adopt-back stays as the safety net. The live-install confirmation remains the manual check in security-model.md.
Activity
hivecommons-hive commentedon Nov 17, 2026
Thanks for filing this issue! To help us reproduce and investigate, could you please include the commit SHA of the build you're running?
You can find it by running:
Or check the bottom of the console UI for the version string.
This issue will be on hold until a SHA is provided. Simply add a comment with the SHA and the label will be automatically removed.
🐛 Sessions: adopt a Codex or OpenCode login refreshed in a session ba…
github-actions commentedon Nov 18, 2026
PR #18793 has merged (#18793) and referenced this issue with a non-closing
Refs #18740rather than a closing keyword.This issue remains open because the merged PR did not use
Closes/Fixes/Resolves. If the fix should close it on merge, use a closing keyword in the PR body; use the opt-inhive: needs-confirmationmarker only when the reporter genuinely must verify before closure.clubanderson commentedon Nov 18, 2026
Commit SHAs for the sweep: the adopt-back half of this issue landed in #18793 (
80ec755); current v5 head is6b79bed19.Remaining scope, which is what is still open here:
src/docs/security-model.mdcovers the adopt-back (stale-file retention and audit entry) and that no credential value is ever logged.[-]🐛 Sessions: Codex and OpenCode OAuth logins can still split from the shared login when a session refreshes them[/-][+]🐛 Sessions: a session's Codex/OpenCode login copy can still refresh and diverge from the shared login (follow-up to #18793)[/+]github-actions commentedon Nov 18, 2026
@clubanderson this reads as a partial or uncertain confirmation, so the issue stays open. If it is fully fixed for you, reply
/fixedto close it; otherwise please describe what is still outstanding.clubanderson commentedon Nov 18, 2026
Claimed. Remaining scope being worked: make a session's own Codex/OpenCode login copy unable to refresh independently of the shared login (option 2), plus the security-model docs check. The live-install check against real Codex and OpenCode files needs a person and stays open on this issue.
hivecommons-hive commentedon Nov 18, 2026
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.
PR #18881 covers this issue: #18881
The PR body says this is partial/non-closing work (
Refs/Part ofor leave-open wording), so Hive will not add a closing keyword. GitHub will not show its issue-list PR icon without a closing keyword; the stage comment is the link.📝 Sessions: document and test the single-owner Codex/OpenCode login (…
hivecommons-hive commentedon Nov 18, 2026
Scanner verification of #18793: option 1 (adopt-back for Codex and OpenCode, with a kept stale copy and an audit entry) is merged and covers 'never leaves the shared login stale', 'deleting a session cannot destroy the only valid login' and 'no credential contents logged'. What remains is the 'two holders never refresh concurrently' guarantee: #18793 did not do option 2 (a copy that cannot refresh), because whether Codex or OpenCode accept a login file without a refresh token can only be checked by running each CLI. Leaving the issue open for that check. No implementation started.
🐝 Hive Agent:
scanner| Instance:hosted-available-oke-11-placeholder-r05x| SHA:unknown— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.327
clubanderson commentedon Nov 18, 2026
Claimed by the maintainer: a dispatched agent is working this, one PR to follow where code is needed. Please do not open a parallel PR.
clubanderson commentedon Nov 18, 2026
Update on this issue from reading the public sources of Codex 0.170.0 (the version src/Dockerfile pins) and OpenCode v1.19.6 and v2.3.2. No live install was touched.
tokens.refresh_tokenis a plain String (token_data.rs:22); withauth_modechatgptAuthTokensit is never refreshed (manager.rs:3578, 3660), and withchatgpta failed refresh is only logged. OpenCode v1:refreshis a required string (auth/index.ts:16) and an oauth entry with an emptyrefreshjust fails afterexpires(codex.ts:145). So a refresh-less session copy (option 2) looks feasible for both: medium confidence for Codex (an undocumented file path), high for the OpenCode v1 file. It needs the session copy re-synced before the access token expires.last_refreshandcodex login statusdo not force a refresh.A read-only runbook with a tested redaction command is ready, and a fixture and tests are on a local branch. This stays open until the live check is done and the session-copy behavior in item 2 is decided.
github-actions commentedon Nov 18, 2026
@clubanderson this reads as a partial or uncertain confirmation, so the issue stays open. If it is fully fixed for you, reply
/fixedto close it; otherwise please describe what is still outstanding.clubanderson commentedon Nov 18, 2026
PR #19117 implements option 2: Codex and OpenCode session copies keep the refresh key with an empty value (like the Claude copy), the hive keeps each copy following the shared login, and adopt-back stays as the safety net. The live-install confirmation remains the manual check in security-model.md.