GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(session): remove message content mutation API by rekram1-node · Pull Request #48043 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

Remove the completed-assistant-message content mutation introduced by #45015 for #44984.

  • Remove PATCH /api/session/:sessionID/message/:messageID (session.messageUpdate), its generated client methods, and Core Session.updateMessage/session-handle operation and dedicated errors.
  • Remove the replacement event from the public event surface and client live-state handling; regenerate clients and OpenAPI documents.
  • Retain the existing durable event definition and projector solely to decode/replay records written by older releases. No database migration is required.
  • Remove mutation-specific tests and adjust existing expectations; add no new tests.

Context and rationale

The original issue requested V1-style part deletion so clients could prune stored tool/reasoning payloads from long sessions, citing database growth. #45015 implemented a broader operation that replaced all content of a completed assistant message in an idle session.

Following maintainer discussion, arbitrary editing of persisted assistant history should not be part of the session API. Plugins that want to exclude tool/reasoning content from model input should use ctx.session.hook("context", ...) to transform the outgoing messages instead. The hook changes model context without rewriting stored history.

That distinction matters for the original report: context filtering does not reclaim disk space or remove content from stored/UI history. Storage retention is a separate concern; this PR does not claim that the context hook solves database growth.

Compatibility

This intentionally breaks callers of session.messageUpdate / Session.updateMessage and removes the corresponding public event. Existing session reads, prompts, execution, and other session operations remain available. Historical replacement events remain replayable, including for users who used the removed API before upgrading.

Created in a separate worktree from latest origin/v2 at d24f8b0810. Follow-up explanation on #44984 can happen after review.

Verification

  • Existing Core session-owned and session-projector suites: 34 passing.
  • Existing Server session-import and session-instances suites: 4 passing.
  • Existing Client solid-data suite: 23 passing.
  • Protocol and Schema event-manifest suites pass.
  • Package typechecks pass: Core, Server, Client, Protocol, Schema, SDK, Plugin.
  • Client and Protocol generated-output checks pass.
  • Website typecheck, generated-output check, production build, and link validation pass.
  • Formatting and git diff --check pass.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node
refactor(session): remove message content mutation API
8e3d09b
Remove session.messageUpdate and Session.updateMessage. Context filtering belongs in the session context hook rather than persisted history edits. Keep historical content-update events available only for durable replay.
@rekram1-node rekram1-node mentioned this pull request Sep 8, 2026
v2: restore part.delete (no way to drop tool/reasoning parts) #44984
Closed
@rekram1-node
rekram1-node merged commit 6ee2ed7 into v2 Sep 9, 2026
9 of 10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node
rekram1-node deleted the drop-message-update branch September 9, 2026 01:27
@pascalandr

pascalandr commented Sep 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

@rekram1-node Could you reconsider this removal and revert it until a narrower replacement is available?

OpenCode owns the database and session consistency, so it is precisely where safe cleanup should happen, not through direct SQL in downstream clients.

I think two different concerns are being conflated here: arbitrary history rewriting and selective removal of stored technical payloads. If messageUpdate is too permissive, could we constrain it or replace it with a dedicated prune operation, rather than remove the capability entirely?

An append-only history could record that content was pruned while preserving the necessary structure. Is there a concrete invariant that makes this unsafe, even for completed tool/reasoning blocks in idle sessions?

Given the immediate impact on CodeNomad 0.20.0, a temporary revert followed by a constrained replacement would let us address your concern without breaking adopted workflow in the meantime.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Sep 9, 2026
v2: selective session-content deletion is missing again after #48043 #48090
Open
feat(pruning): restore opt-in selective deletion through native plugin RPC NeuralNomadsAI/CodeNomad#686
Merged
pascalandr added a commit to NeuralNomadsAI/CodeNomad that referenced this pull request Sep 10, 2026
@pascalandr
feat(pruning): restore opt-in selective deletion through native plugi…
ea37f97
…n RPC (#686)

## Summary

Restore selective deletion of completed assistant tool/reasoning content
after OpenCode removed `session.messageUpdate`, without forking OpenCode
or opening a generic RPC proxy.

The original draft's unconditional `maintenance_required` stub is
replaced by a working **experimental, explicit opt-in** plugin path for
the audited `0.0.0-beta-19419` runtime. The default remains read-only.
Unknown runtimes/storage and active native execution fail closed.
Nothing is installed or enabled on app startup.

## Implementation

- Keep individual/message/group/session cleanup entry points. Send
selected technical indices and a canonical SHA-256 revision, never
arbitrary replacement content, SQL, database filenames or
caller-selected locations.
- Use an ownership-checked CodeNomad broker with a fixed RPC
ID/method/location and worktree-deletion fence. Keep the removed PATCH
and generic RPC routes blocked.
- Bind the plugin's explicitly configured database connection to the
actual daemon DB with a fresh `ctx.storage` challenge. Inside a
synchronous SQLite write transaction, recheck
directory/project/workspace ownership, native durable execution claim,
staged revert/compaction state, event ownership and retained payloads.
- Rely on the audited native **write-ahead execution claim before runner
history reads**, not an `idle` check, plugin mutex or `BEGIN IMMEDIATE`
alone. Never set or release the native claim ourselves.
- CAS only the completed assistant's content array. Preserve IDs,
ordering, text, snapshots, usage and metadata. Commit a content-free
idempotency receipt atomically with the change; identical retries cannot
delete a second shifted block.
- Emit the custom invalidation after commit. Re-read via the native API,
invalidate the SDK transcript and pending rotations, and fence late
reads against newer invalidations. Add a public-API TUI cache companion
and reconnect handling.
- Correct native Windows path encoding; support more than 4,096 selected
parts within explicit request/message budgets.
- Provide an independently packable plugin with main and `./tui`
entrypoints, deployment/safety docs, and a Windows/Linux/macOS native
package CI matrix. Plugin installation remains manual and separately
approved.

## Validation performed locally

| Check | Result |
|---|---|
| Server/plugin/SQLite/broker/proxy tests | 72 passed |
| UI actions, events, SDK projection and stale-read tests | 60 passed |
| Plugin/SQLite/TUI-companion tests under Node 22 | 30 passed |
| Server and UI TypeScript checks | Passed |
| Production UI build | Passed; existing large-chunk warnings |
| Official Windows x64 beta-19419 executable | Passed on a private
daemon and generated DB |
| Independently packed and installed plugin | Same native test passed,
outside the checkout |

The native integration test uses the real beta-19271 network client
against the official beta-19419 runtime, with a local synthetic provider
and no credentials. It verifies actual preview/prune RPC, refusal while
a primary generation holds the native claim, both prompt/transaction
orderings, idempotent retry, two event subscribers, native re-reading,
the subsequent primary model payload, fork isolation, pre-compaction
history without summary changes, and persistence after server restart.

The new three-OS native CI matrix must pass on this head before merge.
No CI result is inferred from the local Windows run.

## Boundaries and remaining validation

- This is a reviewable opt-in implementation, **not general availability
across OpenCode versions/providers/platforms**. Exact runtime gating is
intentional; don't widen it without re-auditing/testing.
- Interactive official TUI, two native CodeNomad windows/scroll
behavior, WSL, provider-specific continuation state and budget/token
estimates are not claimed as validated. TUI companion tests use its
cache contract, not an interactive terminal. Two HTTP subscribers are
not two GUI windows.
- Existing bulk cleanup is per-message and reports failure counts;
dedicated installation/capability and bulk progress/cancel UI are not
added here.
- Existing summaries/native checkpoints, fork copies and already
assembled/sent requests are not retroactively scrubbed. Historical usage
remains historical usage; mock token values are not a token-savings
measurement.
- This changes persisted V2 content, not only visibility. It frees
reusable SQLite pages but does **not** promise a smaller physical file.
No VACUUM, V1 cleanup, durable-event rewriting, automatic backup
restoration or universal repair is included.
- No active user DB was changed, no shared-daemon plugin installed, no
shared OpenCode service stopped/upgraded, and no native desktop
executable/profile rebuilt or replaced. Tests use isolated synthetic
data only.

## Documentation

- [Request flow and validation](dev-docs/SESSION_PRUNING_RPC.md)
- [Audited safety boundary](dev-docs/SESSION_PRUNING_SAFETY.md)
- [Explicit deployment and
recovery](dev-docs/SESSION_PRUNING_DEPLOYMENT.md)

References: anomalyco/opencode#44984, anomalyco/opencode#48043,
anomalyco/opencode#48090 and the maintainer's plugin/RPC direction. No
upstream API or distribution fork is introduced.
@Blind-Striker Blind-Striker mentioned this pull request Sep 11, 2026
feat: cursor lists by inclusion, page sequences, and the beta-19425 pin opencode-dotnet/opencode-sdk-dotnet#72
Merged
@Mirrobot-Agent Mirrobot-Agent mentioned this pull request Sep 15, 2026
fix(session): recover from stale encrypted reasoning on provider rejection #48908
Closed
3 of 6 tasks
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
@rekram1-node
refactor(session): remove message content mutation API (anomalyco#48043)
43f5414
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@rekram1-node @pascalandr
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.