Add /rename builtin slash command#287
Draft
daniel-agentee wants to merge 4 commits into
Draft
Conversation
Codex skills (loaded via SkillsManager) are now advertised to ACP clients
alongside the existing builtin slash commands. Selecting a skill rewrites
the leading "/name ..." text into Codex's implicit-skill form ("$name ...")
before submission, so invocation goes through the same implicit-skill path
the TUI uses when a user types `$` and picks a skill from the popup.
The cache is refreshed at session load and whenever Codex emits
EventMsg::SkillsUpdateAvailable; the latter is intercepted at the
ThreadActor level (not per-submission) and triggers a session-wide
AvailableCommandsUpdate. Skill names that collide with a builtin
(/init, /compact, /review, etc.) are dropped with a warning so a skill
cannot shadow a builtin.
Plugin-supplied skill roots are not yet threaded through — only
user/project/system skills appear today. Following PR can wire the
plugin outcome through to fully match the TUI's coverage.
References zed-industries#190.
Previously the title was persisted to session_index.jsonl but the connected client (Zed) only saw the change on the next session/list refresh — usually after restart. Send a SessionUpdate::SessionInfoUpdate carrying the new title so the client can update its session list in place, no restart needed. Covers both rename surfaces: the session/setTitle JSON-RPC and the /rename builtin slash command both flow through handle_set_title.
Exposes `/rename <new title>` so users can rename the current ACP session from the chat input without a title-editor UI in the client. Works on stock Zed because the command resolves entirely inside codex-acp via the existing Thread::set_title path that writes to $CODEX_HOME/session_index.jsonl. The empty-arg case prints a usage hint instead of a silent no-op, and `rename` is added to builtin_command_names so a same-named skill cannot shadow it.
0f258a0 to
e911a5f
Compare
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.
Summary
Adds
/rename <new title>as a builtin slash command for codex-acp. Typing/rename Fooin any ACP client (including stock Zed.app — no client-side change required) renames the current session: the title is persisted tosession_index.jsonl, the SQLite state DB is updated, and the client repaints its session list inline via theSessionInfoUpdatenotification.Empty argument prints a usage hint instead of being a silent no-op. The new builtin is added to
builtin_command_names()so a same-named skill cannot shadow it.Why
Today users can rename a session only by opening the title editor in the agent panel header — which depends on Zed having merged the title-editor wiring (and on the protocol/handler PRs landing). A slash command works from any ACP client immediately because the dispatch lives entirely inside codex-acp.
What's in this PR
thread.rs:renametobuiltin_command_names()andbuiltin_commands()(with anUnstructured("new session title")input hint so the/picker shows the argument slot).handle_prompt, intercepts/renamebefore theOp::UserInputdispatch. Empty arg →Usage:agent message. Non-empty → callsself.handle_set_title(title)which already persists + emitsSessionInfoUpdate(from Handle session/setTitle and emit SessionInfoUpdate #286), then sends a confirmation chunk. ReturnsStopReason::EndTurnimmediately — never reaches the model.rename_is_listed_in_builtin_commands,slash_rename_without_arg_shows_usage_message,slash_rename_with_arg_writes_title_to_session_index.Tests
29 lib tests pass.
Dependencies (drafted until merged)
This PR is intentionally split out as a separate, smaller concern from the underlying rename infrastructure. It stacks on:
builtin_command_nameslist it introduced).Thread::set_titleand the SessionInfoUpdate emit).I'll mark this PR ready-for-review and rebase to a clean single-commit diff once the dependencies land.