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 — fix(core): keep background compaction from stopping a running Claude Agent session by adamdotdevin · Pull Request #63025 · anomalyco/opencode

fix(core): keep background compaction from stopping a running Claude Agent session #63025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Tarquinen merged 1 commit into dev from claude-compaction-stop
Nov 10, 2026

Uh oh!

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

Merged

fix(core): keep background compaction from stopping a running Claude Agent session #63025

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
bbdf077
fix(core): keep background compaction from stopping a running Claude …
adamdotdevin Nov 10, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

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

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

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

Diff view
Diff view
fix(core): keep background compaction from stopping a running Claude …
…Agent session
  • Loading branch information

Uh oh!

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

@adamdotdevin
adamdotdevin committed Nov 10, 2026
commit bbdf077e980025a1719c91451e48411637c3fc27

There are no files selected for viewing

3 changes: 0 additions & 3 deletions 3 packages/core/src/plugin/provider/claude-agent/claude/sessions.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export interface Request {
readonly sessionID?: string
// Native OpenCode fork lineage, or the session supplying a compaction/generate snapshot.
readonly sourceID?: string
readonly compaction?: boolean
readonly model: string
readonly effort?: Options["effort"]
readonly maxOutputTokens?: number
Expand Down Expand Up @@ -363,8 +362,6 @@ export function registry() {
if (!sourceID) return 0
const source = entries.get(sourceID)
const copy = Effect.gen(function* () {
// Compaction ends the old primary context. Generate only takes a read-only snapshot.
if (request.compaction && source) yield* stop(source)
const record = source?.record ?? (yield* records.get(sourceID))
return yield* branch(entry, request, record)
})
Expand Down
1 change: 0 additions & 1 deletion 1 packages/core/src/plugin/provider/claude-agent/language-model/claude-agent-language-model.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export class Model implements LanguageModelV3 {
{
sessionID,
sourceID,
compaction: kind === "compaction",
model: this.modelId,
effort,
maxOutputTokens: options.maxOutputTokens,
Expand Down
41 changes: 15 additions & 26 deletions 41 packages/core/test/plugin/provider/claude-agent/claude/branches.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect } from "bun:test"
import { Effect, Fiber } from "effect"
import { Effect } from "effect"
import { SessionRecord } from "@opencode/core/plugin/provider/claude-agent/sync/record"
import { RequestKind } from "@opencode/core/plugin/provider/claude-agent/language-model/request-kind"
import { it } from "../../../../lib/effect"
Expand All @@ -15,11 +15,9 @@ describe("Claude history branches", () => {
const claude = FakeClaude.make([
FakeClaude.expectStartup(),
FakeClaude.expectTurn(),
FakeClaude.expectInterrupt(),
FakeClaude.expectStartup(),
FakeClaude.expectTurn({ recording: "billing-error" }),
FakeClaude.expectInterrupt(),
FakeClaude.expectStartup(),
FakeClaude.expectTurn({ index: 1 }),
FakeClaude.expectInterrupt(),
])
Expand All @@ -34,7 +32,7 @@ describe("Claude history branches", () => {
expect(TestSessions.text(yield* TestSessions.reply(test.model, TestSessions.followup())).trim()).toBe(
"COPPER-OTTER",
)
expect(claude.runs[2]!.args).toContain(`--resume=${before!.claudeSessionID}`)
expect(claude.runs).toHaveLength(2)
yield* test.registry.close()
claude.check()
}),
Expand Down Expand Up @@ -235,42 +233,33 @@ describe("Claude history branches", () => {
}),
)

it.effect("compaction drains a parked tool turn and the next primary request starts from the summary alone", () =>
it.effect("compaction leaves a parked tool turn running and the next primary request starts from the summary", () =>
Effect.gen(function* () {
const cancel = FakeClaude.replay("tools-waiting-cancel")
const nextUser = cancel.findIndex((step, i) => i > 1 && step.type === "exchange" && step.input.type === "user")
const steps = cancel.slice(0, nextUser)
const terminal = steps.findIndex(
(step) => step.type === "exchange" && step.replies.some((message) => message.type === "result"),
const tools = FakeClaude.replay("tools")
// The first tool result is the first input after the step that parks.
const parked = tools.findIndex(
(step) => step.type === "exchange" && step.input.response?.response?.mcp_response !== undefined,
)
const ending = steps[terminal]!
if (ending.type !== "exchange") throw new Error("Missing recorded terminal result")
const drain = Promise.withResolvers<void>()
steps[terminal] = { ...ending, beforeResult: drain.promise }
const claude = FakeClaude.make([
...steps,
...tools.slice(0, parked),
FakeClaude.expectStartup(),
FakeClaude.expectTurn({ recording: "utility" }),
FakeClaude.expectInterrupt(),
...tools.slice(parked),
FakeClaude.expectStartup(),
FakeClaude.expectTurn(),
FakeClaude.expectInterrupt(),
])
const test = yield* TestSessions.start(claude)
yield* Effect.addFinalizer(() => Effect.sync(() => drain.resolve()))
const prompt = TestTools.prompt()
TestTools.append(prompt, yield* TestTools.step(test.model, prompt), () => ({
type: "execution-denied",
reason: "Compacted",
}))
const summary = yield* TestSessions.reply(test.model, prompt, "session-a", "compaction").pipe(Effect.forkChild)
yield* Effect.promise(() => claude.started(steps[terminal]!))
expect(claude.forks).toHaveLength(0)
expect(claude.runs).toHaveLength(1)
drain.resolve()
yield* Fiber.join(summary)
TestTools.append(prompt, yield* TestTools.step(test.model, prompt), TestTools.output)
yield* TestSessions.reply(test.model, [...prompt], "session-a", "compaction")
expect(claude.forks).toHaveLength(1)
expect(claude.removed).toEqual([claude.forks[0]!.sessionID])
TestTools.append(prompt, yield* TestTools.step(test.model, prompt), TestTools.output)
expect(TestSessions.text(yield* TestTools.step(test.model, prompt))).toBe("COPPER-OTTER")
expect(claude.runs).toHaveLength(2)
expect(claude.runs[0]!.received.some((message) => message.request?.subtype === "interrupt")).toBe(false)
const compacted = TestSessions.prompt(
"<conversation-checkpoint>Only SUMMARY-HERON remains.</conversation-checkpoint>",
)
Expand Down
Loading
Oops, something went wrong.

Uh oh!

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

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 01402792 — 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.