fix(terminal): restore Codex cards to their own conversations - #80
Merged
howdeploy merged 1 commit intoSep 27, 2026
Merged
Conversation
teo-nex
marked this pull request as ready for review
September 26, 2026 16:52
This was referenced Sep 27, 2026
Contributor
|
@teo-nex, привет! Хочу предупредить: мой #82 (одна модель «после перезапуска» для сессий агентов) построен поверх твоего #80, поэтому GitHub показывает там и твой коммит. Твой механизм для Codex я взял как есть: захват
Поле Несколько мест, где наши подходы расходятся. Предлагаю обсудить, как лучше свести:
Если #80 примут первым, я переставлю #82 на |
howdeploy
pushed a commit
that referenced
this pull request
Sep 27, 2026
Builds on #80 (teo-nex, "restore each Codex card to its own conversation"): its capture of the conversation id from authenticated lifecycle hooks, the validated id saved per card, `codex resume <id>`, the resume picker when no id is known and a plain restart forgetting the id are kept as they are. This extends the same exact resume to Claude Code (`claude --resume <id>`) and OpenCode (`opencode --session <id>`); the field is renamed from codexThreadId to threadId for that, with one per-provider check (canonical UUID for Codex and Claude, `ses_` id for OpenCode) shared by the hook client, the gateway, the store and the launch, and v1 records' codexThreadId still read. Settings → General now offers Don't save / Reopen windows / Continue conversations (settings v21; the old opt-in boolean migrates true→continue, false→off). Session records move to v2 (v1 stays readable): last state at quit or exit, the thread id, a per-card restore flag, and two validated opaque plugin slots (launch options and an environment ref, 4 KB each). No scrollback, prompts or secrets are saved. Restore puts parents before children, resumes a recorded conversation by id, and without one uses a "latest in this folder" flag only when that CLI has one card in the folder (otherwise it starts fresh with a note on the card; Codex opens its picker). Finished cards come back stopped with Restart / Continue (Continue resumes the card's own conversation), and a card whose environment is unavailable is held stopped with its reason instead of running locally. Cards get an options menu with "Don't restore this card". For plugins: the v2 record's two opaque slots are where later extension points keep per-card state across restarts. A launch contributor's chosen options are saved in `options[pluginId]` and an environment's ref in `environment`, both validated and capped at 4 KB, so a restored card can be prepared or placed again (or held stopped with a reason) without the core knowing what the values mean.
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.
CanvasTTY currently restores every saved Codex card with
codex resume --last. When two cards share a working directory, both can reopen the same conversation instead of their own.Capture Codex's
session_idfrom authenticated lifecycle hooks, persist a validated ID with each saved card, and restore withcodex resume <session-id>. Existing saved cards without an ID open Codex's resume picker, avoiding an arbitrary conversation. Explicitly restarting a completed card clears its old ID. The existing "Save terminal sessions" setting remains opt-in.This covers Codex provider cards launched by CanvasTTY. A plain shell terminal in which a user manually runs
codex resumeis outside this change.Validation:
npm test(886/886),npm run typecheck,npm run build, andgit diff --checkpassed. The running CanvasTTY app was not restarted; live UI validation is still pending.