feat(plugin): add session title rename tool#307
Conversation
Add a CodeNomad plugin tool for renaming the active session title and wire it through the existing plugin bridge to the workspace OpenCode instance. This gives the assistant a dedicated, explicit tool for session renaming without introducing a second title storage path or any UI-only workaround.
The implementation follows the repo's existing plugin architecture: the plugin registers a new
ename_session tool, validates the active session context, and calls a CodeNomad server plugin endpoint. On the server side, that endpoint validates the payload, reuses the workspace instance port and authorization header, and forwards the request to OpenCode using the worktree-aware directory context from the tool execution environment.
This commit also fixes the initial proxy bug discovered during validation. OpenCode's generated SDK updates sessions with PATCH /session/{sessionID}, but the first proxy implementation forwarded the request as POST, which allowed the tool to report success without actually renaming the session. Switching the forwarded request to PATCH aligns the bridge with the real SDK contract and makes session title updates apply correctly.
Description persistence and UI display remain intentionally out of scope for this checkpoint. The goal of this snapshot is to make title renaming reliable end-to-end with the smallest correct change and without touching unrelated session metadata behavior.
|
I want you to perform the gatekeeper checks for latest PR state check for regressions |
|
Understood request: perform a gatekeeper review of the latest PR state for regressions and implementation quality. Assumption: this is a review-only request, so I did not change files. Gatekeeper Findings
Better Implementation Notes
Verification Performed
Verification commands attempted:
These verification failures appear to be local dependency-install issues, not direct evidence about the PR code. VerdictRequest changes. The feature shape is good, but the directory forwarding bug is a likely functional regression for the stated worktree-aware requirement and should block merge. -- |
Fixes #306
Summary
This change adds a dedicated plugin tool for renaming the active session title and wires it through the existing CodeNomad plugin bridge to the correct OpenCode workspace instance.
The goal is to let the assistant perform the same session title rename operation that already exists in the UI, without introducing a separate metadata store or bundling in the still-unsettled description feature.

Why
Users can already rename sessions manually in the UI, but there was no supported end-to-end conversational path for the assistant to do the same thing.
That mismatch meant the assistant could acknowledge a rename request without having a repo-native implementation path to update the actual session title. This PR closes that gap with the smallest correct change and keeps the scope intentionally limited to title renaming only.
What Changed
rename_sessionplugin tool inpackages/opencode-config/plugin/lib/session.ts.packages/opencode-config/plugin/codenomad.ts.packages/server/src/server/routes/plugin.tsthat proxies title updates to the workspace OpenCode instance.directoryso the rename follows the existing worktree-aware session targeting behavior.PATCH, matching the real OpenCode SDKsession.updatecontract.Scope Boundaries
Included:
Not included:
Technical Notes
The OpenCode SDK contract for session updates is not
POST; it isPATCH /session/{sessionID}with a body containing the updatable fields such astitle.That detail matters because the first implementation path could appear successful while failing to apply the rename if the bridge used the wrong HTTP method. The final implementation aligns the server proxy with the generated SDK contract so the rename is applied by the actual OpenCode session update endpoint.
Files Changed
packages/opencode-config/plugin/codenomad.tspackages/opencode-config/plugin/lib/session.tspackages/server/src/server/routes/plugin.tsVerification
Performed:
session.update.POSTtoPATCH.packages/serversuccessfully.Build note:
Risks and Follow-up