Repository navigation
Description
Description
This follows up on #44984, which remains closed even though its replacement API has now been removed.
CodeNomad 0.20.0 adopted that API. We still need a supported way to remove selected tool/reasoning content from ongoing sessions without deleting the conversations themselves.
Expected behavior: A native, constrained operation to remove selected technical content while preserving session identity, useful history, and consistency across clients.
There are two needs: freeing model-context capacity and reducing retained history/storage, including a supported way to reclaim unused database space.
Actual behavior:
- V1 supported selective part deletion.
- v2: restore part.delete (no way to drop tool/reasoning parts) #44984 requested its V2 equivalent.
- fix(session): support assistant message content updates #45015 supplied
session.messageUpdate; the issue was closed as resolved. - refactor(session): remove message content mutation API #48043 removed it without an equivalent replacement.
Context hooks can filter model input, but do not clean stored history. Deleting whole sessions after N days is not a substitute: our workflows involve hundreds of parallel, long-lived sessions whose meaningful history must remain available.
OpenCode owns the database schema, migrations, session execution, and synchronization. Safe mutation of that storage belongs in OpenCodeÔÇönot in downstream clients writing directly to its tables.
If arbitrary message replacement is too broad, please provide a narrower prune/redact operation. What concrete invariant prevents selective deletion of completed technical content, and why can that concern not be addressed with restrictions rather than removal?
Could you restore the capability temporarily, or reopen #44984 and track a replacement before treating the V1 use case as resolved? We are happy to help validate it.
OpenCode version
First affected published beta: 0.0.0-beta-19365 (@opencode/cli, published 2026-09-09).
Steps to reproduce
- Open an existing session containing completed tool/reasoning blocks.
- Attempt to remove selected blocks through
session.messageUpdate. - The endpoint and generated client method are gone, with no equivalent selective-deletion operation.
Screenshot and/or share link
- Original report: v2: restore part.delete (no way to drop tool/reasoning parts) #44984
- Replacement API: fix(session): support assistant message content updates #45015
- Removal: refactor(session): remove message content mutation API #48043
Operating System
Windows 11.
Terminal
CodeNomad 0.20.0 development; diagnostic commands run in PowerShell 7.
Activity
github-actions commentedon Sep 9, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:), or Question. Please resubmit using the appropriate template so required fields are captured consistently.Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
session.messageUpdatewas added, which has now been removed per your description.If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Sep 9, 2026
Thank you for updating the issue! It now follows the Bug Report template with clear description, reproduction steps, and system information. The compliance flag has been removed.
opencode-agent commentedon Sep 9, 2026
Could you give us one concrete end-to-end example of how CodeNomad uses this? We want to separate a few potentially different needs:
A concrete before/after session example, plus approximate session count/size, would help us understand the invariant and whether this should be a constrained pruning operation rather than general message mutation.
opencode-agent commentedon Sep 9, 2026
If you can describe the exact flow you want and how CodeNomad would use it step by step, that would be great.
pascalandr commentedon Sep 9, 2026
A typical workflow is a long-running coding session with lots of file reads, searches, build logs, and reasoning. Once a step is finished, I want to keep the discussion and conclusions but remove technical content I no longer need, then continue the same session.
CodeNomad lets users remove one tool/reasoning block, the blocks in a message, or all of them across a session. It previously fetched the completed message, filtered the selected parts, and saved it through
session.messageUpdate. This is manual cleanup, not arbitrary rewriting or automatic pruning.There are two needs: free up model context and clean the stored history so clients no longer have to load those large payloads. The deletion should be reflected across connected clients.
A persisted exclusion marker could help with context, but we’d still need actual cleanup of the stored content. Reclaiming disk space can happen later through a separate maintenance operation—not on every click.
Codenomad's users work with hundreds of parallel, long-lived sessions; A narrow pruning API for completed tool/reasoning blocks would cover this well.
pascalandr commentedon Sep 9, 2026
I’ve now measured the storage impact on an offline backup: 23.12 GB initially, 18.67 GB with VACUUM alone, and 4.92 GB after removing tool/reasoning content from both V2 history and retained V1 tables, then vacuuming.
feat(pruning): restore opt-in selective deletion through native plugi…
DDDMUC commentedon Sep 30, 2026
Adding a data point from plugin-side experiments (OpenCode 1.18.33, plus the current
devsources):experimental.chat.messages.transformhook is already sufficient for removing complete messages from model input — not just tool/reasoning parts. It is triggered inpackages/opencode/src/session/prompt.ts:1255(step 1) andpackages/opencode/src/session/compaction.ts:379, both immediately before the message list is converted for the provider, and mutatingoutput.messagesdrops entries from the request as well as from the compaction summary. So the “model-context capacity” half of this issue is solvable today by a plugin, with no storage mutation, and it works for whole user/assistant messages, not only technical parts.TuiHostSlotMapin@opencode-ai/pluginexposes only app/home/prompt/sidebar slots), and there is no message delete endpoint (onlyGET /session/{id}/message/{messageID}; the range-basedrevertis not a substitute). The resulting UX is “the model forgets, the screen keeps the message”, which matches the storage half of this issue and the measurement above.{}— indevtoo (packages/plugin/src/index.ts:282,prompt.ts:1255,compaction.ts:379). PassingsessionID(and optionallymodel) would let a plugin scope its filter per session instead of carrying a global message-id set. Cheap, additive, no behavior change.To be clear, this is not a request to bring back the removed mutation API (#48043) — it is an attempt to separate what is already solved (model context, via hooks) from what is still open (stored history / disk, e.g. pruning + VACUUM as measured in this thread).
opencodejr commentedon Oct 28, 2026
Thanks for the detailed follow-up, @pascalandr, and for the context on how CodeNomad uses this.
You're asking for a supported, limited way to remove selected completed tool/reasoning content from sessions that are still in use, without deleting the sessions. That would free model context, reduce stored history, and include a supported way to reclaim unused database space. You're also asking for this to happen inside OpenCode rather than through clients writing to its tables directly.
session.messageUpdatewas removed on purpose in #48043, so I'm treating this as a feature request for a narrower replacement rather than a regression. The reasons maintainers gave in #44984 were that session history is meant to be append-only and that any public API has to be supported long-term by every client. Your proposal of restrictions rather than removal (only completed tool/reasoning parts, only idle sessions, events sent to clients) and the separate storage-reclamation need are clear, and maintainers will consider them. I can't promise an outcome.Related:
PATCH /api/session/:sessionID/message/:messageIDAPI that addressed it