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(opencode): send pasted images with turns and steers by nkoynov · Pull Request #16145 · pingdotgg/t3code

fix(opencode): send pasted images with turns and steers #16145

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
juliusmarminge merged 8 commits into pingdotgg:main from nkoynov:fix/opencode2-image-file-parts
Oct 19, 2026

Uh oh!

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

Merged

fix(opencode): send pasted images with turns and steers #16145

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit Hold shift + click to select a range
9747fcd
fix(server): OpenCode 2 turns send pasted images to the model
nkoynov Oct 5, 2026
b9611fb
fix(server): keep path text only for images on an external OpenCode s…
nkoynov Oct 6, 2026
5534558
test(server): assert OpenCode 2 image prompts keep their saved-path text
nkoynov Oct 6, 2026
eaaff72
fix(server): send OpenCode 2 only the pasted images whose saved file …
nkoynov Oct 8, 2026
9efd8bc
Merge remote-tracking branch 'origin/main' into fix/opencode2-image-f…
juliusmarminge Oct 19, 2026
7b33484
fix(opencode): send local images with turns and steers
juliusmarminge Oct 19, 2026
8dfecea
fix(opencode): reject image steers interrupted during file lookup
juliusmarminge Oct 19, 2026
3a3ab2e
fix(opencode): preserve Stop status when discarding image steers
juliusmarminge Oct 19, 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
Prev Previous commit
Next Next commit
fix(opencode): reject image steers interrupted during file lookup
  • Loading branch information

Uh oh!

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

@juliusmarminge
juliusmarminge committed Oct 19, 2026
commit 8dfecea3f834784e99a4100ea1979d3ecf81f5ed

There are no files selected for viewing

96 changes: 96 additions & 0 deletions 96 apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ const resumed = (
readonly supervised?: boolean;
readonly replayGate?: ProviderReplayGate;
readonly attachmentsDir?: string;
readonly fileSystem?: FileSystem.FileSystem;
readonly onPrompt?: (input: unknown) => void;
},
) =>
Expand All @@ -333,6 +334,7 @@ const resumed = (
...entries,
]),
{
...(options?.fileSystem === undefined ? {} : { fileSystem: options.fileSystem }),
...(options?.onPrompt === undefined ? {} : { onPrompt: options.onPrompt }),
...(options?.external === undefined ? {} : { external: options.external }),
...(options?.replayGate === undefined ? {} : { replayGate: options.replayGate }),
Expand Down Expand Up @@ -3451,6 +3453,100 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(IdAllocator.layer, NodeServices.layer))),
);

it.effect("rejects an image steer stopped during attachment resolution without sending it", () =>
Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
const attachmentsDir = yield* fileSystem.makeTempDirectoryScoped({
prefix: "t3-oc2-stopped-image-",
});
const image = ChatImageAttachment.make({
type: "image",
id: ChatAttachmentId.make("thread-opencode2-adapter-12345678-1234-1234-1234-123456789abc"),
name: "screen.png",
mimeType: "image/png",
sizeBytes: 4,
});
const path = resolveAttachmentPath({ attachmentsDir, attachment: image })!;
yield* fileSystem.writeFileString(path, "data");
const resolving = yield* Deferred.make<void>();
const release = yield* Deferred.make<void>();
const prompts: Array<unknown> = [];
const { runtime, thread } = yield* resumed(
[
out("session.prompt", { sessionID: SESSION, text: "<any>" }),
promptAccepted,
event("session.execution.started", { sessionID: SESSION }),
out("session.interrupt", { sessionID: SESSION }),
reply("session.interrupt", { interrupted: true }),
event("session.execution.interrupted", { sessionID: SESSION }),
out("session.prompt", { sessionID: SESSION, text: "<any>" }),
promptAccepted,
event("session.execution.started", { sessionID: SESSION }),
event("session.execution.succeeded", { sessionID: SESSION }),
],
{
attachmentsDir,
onPrompt: (input) => prompts.push(input),
fileSystem: {
...fileSystem,
exists: (file) =>
file === path
? Effect.gen(function* () {
yield* Deferred.succeed(resolving, undefined);
yield* Deferred.await(release);
return yield* fileSystem.exists(file);
})
: fileSystem.exists(file),
},
},
);
const stopped = yield* Deferred.make<void>();
const completed = yield* Deferred.make<void>();
const terminals: Array<string> = [];
yield* runtime.events.pipe(
Stream.tap((event) => {
if (event.type !== "turn.terminal") return Effect.void;
terminals.push(event.status);
return Deferred.succeed(terminals.length === 1 ? stopped : completed, undefined);
}),
Stream.runDrain,
Effect.forkScoped,
);
yield* runtime.startTurn(turnInput(thread));
const steer = yield* runtime
.steerTurn({
threadId,
runId: RunId.make("run:opencode2-adapter"),
providerThread: thread,
providerTurnId: yield* providerTurnId,
message: {
...turnInput(thread).message,
messageId: MessageId.make("message:opencode2-adapter:steer"),
text: "Do not send this image after Stop.",
attachments: [image],
},
})
.pipe(Effect.exit, Effect.forkScoped);
yield* Deferred.await(resolving);
yield* runtime.interruptTurn({
providerThread: thread,
providerTurnId: yield* providerTurnId,
});
yield* Deferred.await(stopped);
yield* Deferred.succeed(release, undefined);
const result = yield* Fiber.join(steer);
assert.lengthOf(prompts, 1);
assert.isTrue(Exit.isFailure(result));
if (Exit.isFailure(result)) {
assert.deepInclude(Cause.squash(result.cause), { _tag: "ProviderAdapterProtocolError" });
}
yield* runtime.startTurn(secondTurn(thread));
yield* Deferred.await(completed);
assert.lengthOf(prompts, 2);
assert.deepEqual(terminals, ["interrupted", "completed"]);
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
);

it.effect("reads user and assistant text from the session's message list", () =>
Effect.gen(function* () {
const runtime = yield* openCode2ReplayRuntimeWithInstructions([
Expand Down
5 changes: 4 additions & 1 deletion 5 apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.testkit.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
type ProviderReplayTranscript,
} from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Schema from "effect/Schema";
import * as HttpClient from "effect/http/HttpClient";
Expand Down Expand Up @@ -285,9 +286,11 @@ export const openCode2ReplayRuntime = (
readonly borrowers?: { current: number };
readonly replayGate?: ProviderReplayGate;
readonly attachmentsDir?: string;
readonly fileSystem?: FileSystem.FileSystem;
},
) =>
Effect.gen(function* () {
const fileSystem = options?.fileSystem ?? (yield* FileSystem.FileSystem);
const adapter = yield* makeReplayAdapter(
{
provider: OPENCODE_PROVIDER,
Expand All @@ -297,7 +300,7 @@ export const openCode2ReplayRuntime = (
entries,
},
options,
);
).pipe(Effect.provideService(FileSystem.FileSystem, fileSystem));
return yield* adapter.openSession({
threadId: ThreadId.make("thread:opencode2-adapter"),
providerSessionId: ProviderSessionId.make("provider-session:opencode2-adapter"),
Expand Down
14 changes: 14 additions & 0 deletions 14 packages/provider-opencode/src/server/v2/adapter.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3609,6 +3609,20 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr
turn.steers.add(inboxID);
state.strandedSteers.delete(inboxID);
const files = yield* promptFiles(steerInput.message.attachments);
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Resolved

Uh oh!

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

if (state.active !== turn || turn.interrupted) {
yield* lock.withPermit(
Effect.gen(function* () {
turn.steers.delete(inboxID);
// Stop may have stranded this steer, but it never reached OpenCode.
state.strandedSteers.delete(inboxID);
if (state.active === turn) yield* endIfSettled(state, turn);
}),
);
return yield* new ProviderAdapter.ProviderAdapterProtocolError({
driver: OPENCODE_PROVIDER,
detail: `OpenCode turn ${steerInput.providerTurnId} is not active`,
});
}
yield* client.session
.prompt({
sessionID: Session.ID.make(sessionId),
Expand Down
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.