Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
bb5dc0b
fix(session): bound repetition-guard recovery to its own caller (Refs…
Nov 1, 2026
0742f7b
merge PR #777 (bound repetition-guard recovery to its own caller) ont…
agenteinstinct1-max Nov 1, 2026
7e781da
fix(session): keep the finish nudge in flight so it owns its generati…
agenteinstinct1-max Nov 1, 2026
909e3e0
fix(session): keep the transcript for an in-flight finish nudge (Refs…
agenteinstinct1-max Nov 1, 2026
7de3d4e
merge PR #783 head (909e3e0) onto the accepted tip 897e851
agenteinstinct1-max Nov 1, 2026
35c2799
fix(session): settle a nudged finish on its own answer and turn (Refs…
agenteinstinct1-max Nov 1, 2026
b8b4424
test(session): type the finish-part filter as a tool part (Refs #783)
agenteinstinct1-max Nov 1, 2026
645c221
merge: carry PR #786 onto accepted tip 50d6a232
agenteinstinct1-max Nov 1, 2026
0840fcf
test(tui): wait for diff request readiness (Refs #789)
agenteinstinct1-max Nov 1, 2026
1c5eba7
chore: integrate published session and TUI checkpoint (Refs #738, Ref…
agenteinstinct1-max Nov 1, 2026
5c69589
fix(session): keep finish continuations with their prompt root (Refs …
agenteinstinct1-max Nov 1, 2026
333aff8
fix(session): satisfy lineage types and keep ordering lookup bounded …
agenteinstinct1-max Nov 1, 2026
88ae3ed
chore(session): checkpoint verified surviving #790 worktree
agenteinstinct1-max Nov 1, 2026
f0434f9
merge: reconnect verified #790 checkpoint with published head
agenteinstinct1-max Nov 1, 2026
b4236bf
fix(session): repair review continuation ownership and compaction set…
agenteinstinct1-max Nov 1, 2026
c572efe
fix(session): scope compaction ownership and settle nudge budgets
agenteinstinct1-max Nov 1, 2026
fee9bde
fix(session): guard repeated reasoning and scope retry fixture
agenteinstinct1-max Nov 2, 2026
5392a23
Merge accepted dev-vibecoded base
arena-agent Nov 2, 2026
8e9212d
fix(session): resolve shared helper and isolate share catalog test
arena-agent Nov 2, 2026
59c7bbb
Merge accepted dev-vibecoded test harness
arena-agent Nov 2, 2026
392de3d
Merge accepted attachment fallback repair
arena-agent Nov 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions packages/opencode/src/session/compaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { ProviderV2 } from "@opencode-ai/core/provider"
import { ModelV2 } from "@opencode-ai/core/model"
import { buildPrompt } from "@opencode-ai/core/session/compaction"
import { SessionCompactionEvent } from "@opencode-ai/schema/session-compaction-event"
import { COMPACTION_CONTINUATION, turnLineage } from "./subagent-result"

export const Event = SessionCompactionEvent

Expand Down Expand Up @@ -174,6 +175,7 @@ export interface Interface {
sessionID: SessionID
auto: boolean
overflow?: boolean
promptID?: MessageID
}) => Effect.Effect<"continue" | "stop">
readonly create: (input: {
sessionID: SessionID
Expand Down Expand Up @@ -322,6 +324,7 @@ const layer = Layer.effect(
sessionID: SessionID
auto: boolean
overflow?: boolean
promptID?: MessageID
}) {
const parent = input.messages.findLast((m) => m.info.id === input.parentID)
if (!parent || parent.info.role !== "user") {
Expand Down Expand Up @@ -468,6 +471,7 @@ const layer = Layer.effect(
if (result === "continue" && input.auto) {
if (replay) {
const original = replay.info
const replayPromptID = input.promptID ?? MessageID.make(turnLineage(input.messages, original.id))
const replayMsg = yield* session.updateMessage({
id: MessageID.ascending(),
role: "user",
Expand All @@ -479,19 +483,47 @@ const layer = Layer.effect(
tools: original.tools,
system: original.system,
})
let linked = false
for (const part of replay.parts) {
if (part.type === "compaction") continue
const replayPart =
part.type === "file" && MessageV2.isMedia(part.mime)
? { type: "text" as const, text: `[Attached ${part.mime}: ${part.filename ?? "file"}]` }
: part
// The replay is runner-owned continuation of the compacted turn,
// not a new caller boundary. Link its first text part so ownership
// and anti-spoof checks resolve to the original prompt.
const linkedPart =
!linked && replayPart.type === "text"
? {
...replayPart,
synthetic: true,
metadata: {
...("metadata" in replayPart ? replayPart.metadata : undefined),
[COMPACTION_CONTINUATION]: { promptID: replayPromptID },
},
}
: replayPart
if (!linked && replayPart.type === "text") linked = true
yield* session.updatePart({
...replayPart,
...linkedPart,
id: PartID.ascending(),
messageID: replayMsg.id,
sessionID: input.sessionID,
})
}
if (!linked) {
yield* session.updatePart({
id: PartID.ascending(),
messageID: replayMsg.id,
sessionID: input.sessionID,
type: "text",
synthetic: true,
text: "",
metadata: { [COMPACTION_CONTINUATION]: { promptID: replayPromptID } },
time: { start: Date.now(), end: Date.now() },
})
}
}

if (!replay) {
Expand Down Expand Up @@ -537,7 +569,10 @@ const layer = Layer.effect(
// Internal marker for auto-compaction followups so provider plugins
// can distinguish them from manual post-compaction user prompts.
// This is not a stable plugin contract and may change or disappear.
metadata: { compaction_continue: true },
metadata: {
compaction_continue: true,
...(input.promptID ? { [COMPACTION_CONTINUATION]: { promptID: input.promptID } } : {}),
},
synthetic: true,
text,
time: {
Expand Down
Loading
Loading