Repository navigation
feat: SessionOptions.name and SessionUnavailableError - #369
Merged
Merged
Conversation
A host that shares the user's native home has its sessions show up in the user's own app, unnamed, and two resume refusals follow from the user's app (codex 0.162.0): an archived thread and a thread another app-server holds. Both reached the host as generic errors. - SessionOptions.name: the session's display name, through claude `--name`, codex `thread/name/set` and pi `setSessionName`. A new session gets it; a resume sets it only where the runtime reports the current name and there is none (codex, pi), so a user's name is never replaced; claude keeps its name on resume. Every other runtime refuses it. - SessionUnavailableError with reason `archived` or `in_use`, from codex's -32600 words. OAR never unarchives: that reverses the user's own action, and the host decides. Evidence: experiments/codex-session-name.ts and vendor tests for codex, claude and pi that read the name back through each runtime's own interface; the codex one also produces both refusals with a second app-server standing in for the user's app. Co-Authored-By: Claude Opus 5.5 <[email protected]>
From a second review of the session name change: - A blank SessionOptions.name fails the open before anything starts. claude and pi opened unnamed without a word, and codex refused it only after the thread opened. - codex names the thread after the resume effort check, and pi after its model and effort checks, so a refused open renames nothing. - pi writes the name as its own `--name` does, a session_info entry on the session manager, so no extension sees a rename event; a resume names only a session that never had one, keeping a name the user cleared. - Docs: morph's refused list, the codex pinning comment, the matrix rows. - Tests: blank names on claude, codex and pi; pi-durable's refusal; the unavailable error's redaction; an unnamed codex thread named on resume. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
xxchan
added a commit
that referenced
this pull request
Oct 12, 2026
Release OAR and CLI 0.59.0. This PR changes only the two package version fields. **Added: `SessionOptions.name`** (#368, #369) - The session's display name in the runtime's own UI and session list, so a user who shares the runtime's home with a host can tell the host's sessions from their own: - claude: `--name`; - codex: `thread/name/set`; - pi: a `session_info` entry, as pi's own `--name` writes it. - A new session gets it. A resume never replaces a name the session has, which may be the user's: - codex and pi name a resumed session only when it has none (pi: never had one); - claude keeps its name on resume. - The name is set only once the open's checks pass, and a blank name fails the open before anything starts. - cursor, kimi, grok, antigravity, opencode, pi-durable and morph refuse it with `UnsupportedOptionError`. **Added: `SessionUnavailableError`** (#368, #369) - `session({ resume })` rejects with it when the runtime keeps the conversation but will not open it now. It carries `sessionId`, `reason` and `cause: { method, native }`. - `archived`: the user archived it in their app. OAR never unarchives it: that reverses the user's own action, so the host decides. - `in_use`: another process, such as the user's app, holds it. Retry once that process lets go. - codex reports both (`session <id> is archived. …`, `thread <id> already has an active writer`). Before, both were plain errors. **Behavior changes** - `RefusableSessionOption` gains `"name"`. - A codex resume of an archived thread, or of one another app-server holds, rejects with `SessionUnavailableError` instead of a plain `Error`. The message and cause are unchanged. Validation: #369 passed all 17 checks on its final head, and its merged tree equals its CI tree. Verified with scripted providers and no tokens (`experiments/codex-session-name.ts`, codex 0.162.0, a second app-server standing in for the user's app). New vendor tests read the name back through codex, claude and pi themselves, and produce both codex refusals. A second review by a subagent found that a blank name was silently dropped on claude and pi, and that a later check could refuse an open after the rename. Both were fixed before merge. After this PR passes CI and merges, tag its exact squash commit as `v0.59.0` to trigger npm trusted publishing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: exe.dev user <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
xxchan
added a commit
that referenced
this pull request
Oct 12, 2026
…372) Found by Lookout's daily inspection of 0.59.0 (#369). - A blank `SessionOptions.name` threw a plain `Error`. Invalid `additionalDirectories` throw `UnsupportedOptionError` naming the option, so a host that catches by type missed the name case. - A name with a NUL character reached claude's command line and failed in Node's spawn ("The argument 'args[12]' must be a string without null bytes"). Both now reject with `UnsupportedOptionError` on `name` before anything starts, on claude, codex and pi (the runtimes that take a name), with the message `name must not be blank or contain NUL characters`. Docs and the `SessionOptions` comment say so. **Behavior change:** a blank name's error is now an `UnsupportedOptionError` instead of a plain `Error`. Released in 0.59.0 earlier today. Validation: `tests/refused-session-options.test.ts` covers `""`, `" "` and `"a\0b"` on claude, codex and pi. Typecheck, lint and the full unit suite (1754 tests) pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: exe.dev user <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Closes #368.
Why. A host that shares the user's native home (for example
~/.codex) has its sessions show up in the user's own app, unnamed. Two resume refusals follow from what the user does in that app, and both reached the host as generic errors:Session name
SessionOptions.nameis the session's display name, set through each runtime's own interface:--nameon a new session. A resume leaves it alone, because--namethere replaces the name the session has, which may be the user's.thread/name/setonce the thread is open and the open's checks pass. On resume, only when thethread/resumereply shows no name.session_infoentry on the session manager, as pi's own--namewrites it, once the open's checks pass. On resume, only when the session never had one, so a name the user cleared stays cleared.UnsupportedOptionError, declared inrefusedSessionOptions.Unavailable resume targets
SessionUnavailableErrorhassessionId,reason(archivedorin_use) andcause: { method, native }, alongsideSessionNotFoundError. It is exported from both contract entries.-32600words to it:session <id> is archived. …andthread <id> already has an active writer. An unloaded sub-agent's refusal keeps its own error.Behavior changes
RefusableSessionOptiongains"name".SessionUnavailableError, not a plainError. The message and cause are unchanged.Evidence (scripted providers, no tokens)
experiments/codex-session-name.ts, codex 0.162.0, with a second app-server standing in for the user's app:thread/name/setreads back onthread/readand on the resume reply;thread/unarchivethe resume works and a turn completes.codex-session-name(codex-aimock): both refusals by reason, the name read back, a resume that keeps the existing name, and an unnamed thread named on resume.claude-session-name(claude-aimock): claude reports the name assession_title_changed, and a resume given another name keeps the original.pi-session-name(pi-aimock): pi's own session list shows the name, a resume keeps it, and an unnamed session gets one on resume.null,""and an existing name;🤖 Generated with Claude Code