Repository navigation
[Feat] Preserve structured Session history after native loss - #2990
Closed
roomote-roomote[bot] wants to merge 1 commit into
Closed
roomote-roomote[bot] wants to merge 1 commit into
roomote-roomote[bot] wants to merge 1 commit into
Conversation
Contributor
roomote-roomote
Bot
requested review from
brunobergher,
daniel-lxs and
mrubens
as code owners
September 19, 2026 18:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changed
fast_agent_conversations. Historical per-turn system prompts are removed, private Sessions redact all tool payloads, and shared Sessions redact personalization and integrations marked with private data policy while preserving tool identity and lifecycle state.opencode importCLI path.0108and focused SDK capture, encryption, snapshot lifecycle, recovery, stale/interrupted state, import failure, privacy redaction, image/tool, and compaction coverage.Why this change was made
Fast Sessions already persist their last OpenCode Session ID, but a missing native store still falls back to flattened visible text. OpenCode
1.18.30supports structured native restoration through its CLI import format, so this prototype preserves the healthy native representation and uses that supported path before accepting the lossy fallback.This is intentionally separate from #2966 (historical image availability) and #2596 (canonical event projection and freshness semantics). It does not depend on either branch.
Impact
After a snapshot has been captured, a Fast Session whose local OpenCode state disappears can retain structured user/assistant roles, ordered parts, direct image input, completed tool results without re-executing those tools, and native compaction context. Existing Sessions and any bounded, stale, interrupted, unreadable, or failed snapshot continue through the explicit best-effort compatibility rebuild.
The snapshot is internal recovery material only. It is not added to transcript or API responses.
Prototype limitations
Validation evidence
pnpm lint:fastpassed.pnpm check-types:fastpassed across 27 packages.pnpm knippassed with only the existing Mint configuration hint.@roomote/cloud-agentsand@roomote/db.0108applied successfully to the local development database; the updated schema was pushed to the test database and real-Postgres assertions verified encrypted storage plus conditional one-shot claim.Integrated disposable runtime smoke
An additional smoke ran the real
answerFastAgentQuestionorchestration, native tool bridge, session manager, Postgres snapshot column, encryption/claim repository, and pinnedopencode-ai@1.18.30CLI in the local deployment. Only the OpenAI-compatible provider and Slack adapter were deterministic localhost stubs; no real model, live Slack, production data, or external side effect was used.All 33 assertions passed:
warmand did not repeat the historical reaction side effect.cold_resumevalidation failure,Imported a healthy OpenCode snapshot, then successfulcold_resumewith nofallback_rebuild.call_counter_initial, and the matchingrole: "tool"result. The reaction counter remained one.What did we do so far?, the summary, retained tail, and new turn.opencode importlogged the import failure, selected compatibility fallback, and never made the partial fresh-ID import durable.Sanitized provider-boundary and recovery-log evidence: integrated smoke summary.
How to test
Automated
Disposable runtime recovery
0108and run a Fast Session through a turn containing a harmless completed tool call and an image.fast_agent_conversations.opencode_snapshotis populated ciphertext and the normal transcript/API does not expose it.OPENCODE_COMMAND; confirm the compatibility rebuild answers the turn and no partial imported Session becomes durable.