Skip to content

feat(plugin): add session title rename tool#307

Open
VooDisss wants to merge 1 commit intoNeuralNomadsAI:devfrom
VooDisss:dev
Open

feat(plugin): add session title rename tool#307
VooDisss wants to merge 1 commit intoNeuralNomadsAI:devfrom
VooDisss:dev

Conversation

@VooDisss
Copy link
Copy Markdown
Contributor

@VooDisss VooDisss commented Apr 9, 2026

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.
image

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

  1. Added a new rename_session plugin tool in packages/opencode-config/plugin/lib/session.ts.
  2. Registered the session tool set in packages/opencode-config/plugin/codenomad.ts.
  3. Added a plugin server endpoint in packages/server/src/server/routes/plugin.ts that proxies title updates to the workspace OpenCode instance.
  4. Forwarded the current tool execution directory so the rename follows the existing worktree-aware session targeting behavior.
  5. Corrected the proxy implementation to use PATCH, matching the real OpenCode SDK session.update contract.

Scope Boundaries

Included:

  • Session title rename tool
  • Plugin registration
  • Server bridge for title updates
  • Worktree-aware forwarding via directory context

Not included:

  • Description persistence
  • Description rendering in the UI
  • Session tooltip changes
  • Any broader session metadata model changes

Technical Notes

The OpenCode SDK contract for session updates is not POST; it is PATCH /session/{sessionID} with a body containing the updatable fields such as title.

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.ts
  • packages/opencode-config/plugin/lib/session.ts
  • packages/server/src/server/routes/plugin.ts

Verification

Performed:

  1. Verified the generated OpenCode SDK contract for session.update.
  2. Confirmed the plugin can call the new bridge endpoint.
  3. Confirmed the feature works after switching the proxied request from POST to PATCH.
  4. Rebuilt packages/server successfully.

Build note:

  • The server build passes.
  • The build still emits existing UI/Vite warnings unrelated to this change.

Risks and Follow-up

  1. Description handling remains intentionally postponed and should be handled as a separate follow-up once the storage and UX direction is settled.
  2. If future session metadata tools are added, they should continue to reuse the same plugin bridge pattern instead of creating parallel storage behavior.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add plugin tool for renaming the active session title

1 participant