Skip to content

v2: selective session-content deletion is missing again after #48043 #48090

Open

Description

@pascalandr

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:

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

  1. Open an existing session containing completed tool/reasoning blocks.
  2. Attempt to remove selected blocks through session.messageUpdate.
  3. The endpoint and generated client method are gone, with no equivalent selective-deletion operation.

Screenshot and/or share link

Operating System

Windows 11.

Terminal

CodeNomad 0.20.0 development; diagnostic commands run in PowerShell 7.

Activity

  1. github-actions commented on Sep 9, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The issue does not use one of the three required templates: Bug Report, Feature Request (title must start with [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:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. github-actions commented on Sep 9, 2026

    @github-actions
    Contributor

    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.

  3. opencode-agent commented on Sep 9, 2026

    @opencode-agent
    Contributor

    Could you give us one concrete end-to-end example of how CodeNomad uses this? We want to separate a few potentially different needs:

    • Is the primary problem persistent database/disk growth? If so, roughly how large or fast-growing are these sessions, and do you specifically need the operation to reclaim filesystem space?
    • Is the primary problem model-context capacity? If hooks already omit these parts from model input, what remains unsolved—such as repeatedly breaking prompt-cache prefixes or the cost/complexity of filtering?
    • Is the desired behavior automatic pruning of old/large tool outputs, manual deletion of individually selected parts, or both? Which part types do you remove in practice?
    • Must the deletion be reflected in stored history and every connected client, or would a persisted “exclude from future model context” marker satisfy the workflow?

    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.

  4. opencode-agent commented on Sep 9, 2026

    @opencode-agent
    Contributor

    If you can describe the exact flow you want and how CodeNomad would use it step by step, that would be great.

  5. pascalandr commented on Sep 9, 2026

    @pascalandr
    Author

    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.

  6. pascalandr commented on Sep 9, 2026

    @pascalandr
    Author

    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.

  7. DDDMUC commented on Sep 30, 2026

    @DDDMUC

    Adding a data point from plugin-side experiments (OpenCode 1.18.33, plus the current dev sources):

    1. The experimental.chat.messages.transform hook is already sufficient for removing complete messages from model input — not just tool/reasoning parts. It is triggered in packages/opencode/src/session/prompt.ts:1255 (step 1) and packages/opencode/src/session/compaction.ts:379, both immediately before the message list is converted for the provider, and mutating output.messages drops 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.
    2. What a plugin cannot do (verified): hide the row in the transcript. The TUI plugin surface has no message-content slot (TuiHostSlotMap in @opencode-ai/plugin exposes only app/home/prompt/sidebar slots), and there is no message delete endpoint (only GET /session/{id}/message/{messageID}; the range-based revert is 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.
    3. Small API gap for plugin authors: the hook input is {} — in dev too (packages/plugin/src/index.ts:282, prompt.ts:1255, compaction.ts:379). Passing sessionID (and optionally model) 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).

  8. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    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.messageUpdate was 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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions