CodeNomad/scripts
Pascal André db1f552afd
fix(usage): use selected native V2 Codex credentials (#811)
## Summary

I replaced Codex Usage's legacy auth-file reads with the connected
OpenCode V2 daemon's selected ChatGPT OAuth credential. This addresses
the stale-file mismatch described in #808 without guessing WSL
credential paths or substituting another account.

- Resolve the provider integration in the owned session's native
location; use only its selected active credential and native accountID.
- Keep credentials server-only, OAuth refresh native-owned, and
credential export/generic RPC blocked through the browser proxy.
- Fence warm and pending quota results on account changes, reconnects
and session movement; scope the visible panel to its instance/session.
- Bound quota HTTP, reject redirects and sanitize errors. No SQLite
access or legacy/Codex CLI fallback.

The credential-list API requires OpenCode 2.0.20 for this feature only.
Older runtimes, expired native tokens and non-ChatGPT connections fail
closed; the global application minimum is unchanged. Other providers'
credential integrations are outside this focused fix.

## Validation

- Server/UI typechecks; 85 server tests; five UI unit tests; three
rendered browser scenarios; UI build and diff checks passed.
- A fresh native 2.0.20 Windows daemon with synthetic credentials
exercises the production adapter: selected OAuth/accountID, key-account
switch invalidating a warm snapshot, and recovery despite stale
auth.json. Quota HTTP is mocked; no shared daemon or real credentials
are used.
- This fixes the confirmed integration mismatch, but I have not
reproduced the author's real WSL/live account failure.

Closes #808.

Maintenance: existing `packages/server/src/server/http-server.ts`
(~2,317 lines) and `packages/ui/src/lib/api-client.ts` (~613 lines)
exceed the source-size guideline; their wiring changes remain small.
2026-09-30 17:29:13 +02:00
..
fixtures feat(composer): unify native device attachments and project references (#729) 2026-09-24 23:12:44 +02:00
winget chore: TASK-075 automate Winget updates on release (#513) 2026-06-03 09:03:46 +02:00
bump-version.js Fix bumpVersion script for both npm and tauri 2026-03-31 20:15:16 +01:00
compare-user-html-rendering.mjs fix(chat): display user HTML as literal source (#777) 2026-09-25 09:52:18 +02:00
desktop-server-resources.cjs feat(opencode): migrate CodeNomad to native V2 (#647) 2026-09-04 11:36:11 +01:00
desktop-server-resources.test.cjs feat(browser): add autonomous native previews (#666) 2026-09-18 17:46:14 +02:00
native-fixture-guards.mjs test(opencode): bound native migration acceptance and cleanup 2026-09-20 16:50:04 +02:00
native-fixture-guards.test.mjs test(opencode): bound native migration acceptance and cleanup 2026-09-20 16:50:04 +02:00
prepare-node-runtime.cjs feat(opencode): enforce stable runtime support and add managed setup 2026-09-20 16:09:36 +02:00
prepare-node-runtime.test.cjs feat(opencode): enforce stable runtime support and add managed setup 2026-09-20 16:09:36 +02:00
profile-ui-motion.mjs fix(status): keep connected MCP indicators static at rest (#806) 2026-09-30 14:03:19 +02:00
smoke-packaged-resources.cjs chore(desktop): upgrade bundled Node to 24.20.0 LTS (#679) 2026-09-19 22:01:30 +02:00
test-attachment-picker-desktop.mjs feat(composer): unify native device attachments and project references (#729) 2026-09-24 23:12:44 +02:00
test-automation-native.mjs fix(startup): restore saved sessions promptly and stop plugin heartbeat reloads (#712) 2026-09-19 12:39:23 +02:00
test-blank-session-cleanup-native.mjs fix(sessions): preserve populated sessions during automatic cleanup (#755) 2026-09-23 11:53:01 +02:00
test-electron-owner-close.mjs fix(electron): avoid destroyed window access on close (#785) 2026-09-28 13:12:07 +02:00
test-git-degraded-native.mjs fix(git): keep conversations usable without backend Git (#757) 2026-09-23 14:18:17 +02:00
test-native-event-relay.mjs fix(events): isolate slow routing from the shared native stream (#719) 2026-09-19 22:51:07 +02:00
test-native-worktree-management.mjs fix(worktrees): bound ownership refreshes and lazily cache inventories (#708) 2026-09-18 13:58:35 +02:00
test-opencode-history-migration.mjs fix(opencode): qualify 2.0.15 and preserve generated proxy URLs (#752) 2026-09-23 12:56:03 +02:00
test-opencode-install-native.mjs fix(opencode): retire private runtime fallback and restore first-run setup (#760) 2026-09-24 00:25:40 +02:00
test-opencode-location-native.mjs fix(opencode): align current contracts and fence native message settlement (#728) 2026-09-20 13:48:53 +02:00
test-opencode-proxy-native.mjs feat(composer): unify native device attachments and project references (#729) 2026-09-24 23:12:44 +02:00
test-opencode-setup-desktop.mjs fix(opencode): retire private runtime fallback and restore first-run setup (#760) 2026-09-24 00:25:40 +02:00
test-opencode-setup-wsl.mjs test(opencode): certify bounded WSL setup and reload effects 2026-09-20 17:21:31 +02:00
test-opencode-upgrade-native.mjs chore(opencode): qualify and recommend stable 2.0.18 2026-09-26 16:38:40 +02:00
test-provider-usage-native.mjs fix(usage): use selected native V2 Codex credentials (#811) 2026-09-30 17:29:13 +02:00
test-session-aside-native.mjs feat(chat): add native /btw side questions 2026-09-21 17:23:11 +02:00
test-session-environment-native.mjs fix(opencode): qualify 2.0.15 and preserve generated proxy URLs (#752) 2026-09-23 12:56:03 +02:00
test-session-fork-native.mjs feat(sessions): fork after user and assistant messages (#718) 2026-09-19 21:50:59 +02:00
test-session-history-native.mjs feat(history): query full sessions and clean technical content through native RPC 2026-09-20 11:02:31 +02:00
test-session-interrupt-native.mjs fix(sessions): keep Stop and double Escape from restarting the parent (#770) 2026-09-24 21:54:09 +02:00
test-session-navigation-native.mjs fix(ui): preserve semantic icons for historical timeline tools (#738) 2026-09-21 23:46:51 +02:00
test-session-pruning-native.mjs merge(dev): qualify history integration before PR 696 merge 2026-09-21 00:30:53 +02:00
test-session-pruning-ui.mjs chore(opencode): qualify and recommend stable 2.0.19 2026-09-29 13:44:20 +02:00
test-tauri-input-deadlock.mjs fix(tauri): prevent Windows input reentrancy deadlocks (#773) 2026-09-24 21:02:20 +02:00
test-tauri-view-menu.mjs fix(tauri): keep View menus responsive through native focus changes (#748) 2026-09-22 18:18:47 +02:00
test-worktree-families-native.mjs feat(v2): manage session families across worktrees (#649) 2026-09-17 22:57:37 +02:00
verify-bundled-node.cjs build: bundle node runtime for desktop packages 2026-05-04 20:08:04 +01:00