Skip to content

Commit 153c326

Browse files
fix(opencode): background shell Details show the command
AI-assisted; verified with the tests and tools listed above.
1 parent dca900e commit 153c326

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
10051005
)
10061006
.at(-1);
10071007
assert.deepEqual(roster ?? [], [
1008-
{ taskId: "sh_1", kind: "command", description: SHELL_COMMAND },
1008+
{ taskId: "sh_1", kind: "command", command: SHELL_COMMAND, description: SHELL_COMMAND },
10091009
]);
10101010
assert.isTrue(yield* runtime.hasPendingBackgroundWork!);
10111011
}).pipe(Effect.scoped),
@@ -1028,7 +1028,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
10281028
yield* runtime.startTurn(turnInput(thread));
10291029
yield* watch.until(() => watch.state.variant === "drained");
10301030
assert.deepEqual(watch.state.roster, [
1031-
{ taskId: "sh_1", kind: "command", description: SHELL_COMMAND },
1031+
{ taskId: "sh_1", kind: "command", command: SHELL_COMMAND, description: SHELL_COMMAND },
10321032
]);
10331033
assert.isTrue(watch.state.pending);
10341034
}).pipe(Effect.scoped),
@@ -1046,7 +1046,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
10461046
yield* watch.until(() => watch.terminals.length > 0);
10471047
assert.deepEqual(watch.terminals, ["completed"]);
10481048
assert.deepEqual(watch.state.roster, [
1049-
{ taskId: "sh_1", kind: "command", description: SHELL_COMMAND },
1049+
{ taskId: "sh_1", kind: "command", command: SHELL_COMMAND, description: SHELL_COMMAND },
10501050
]);
10511051
yield* TestClock.adjust("1 minute");
10521052
yield* watch.until(() => watch.state.roster?.length === 0);
@@ -1216,6 +1216,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
12161216
assert.deepEqual(shell, {
12171217
taskId: "sh_child",
12181218
kind: "command",
1219+
command: SHELL_COMMAND,
12191220
description: SHELL_COMMAND,
12201221
parentTaskId: "call-background",
12211222
});
@@ -1311,6 +1312,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
13111312
assert.deepEqual(shell, {
13121313
taskId: "sh_grandchild",
13131314
kind: "command",
1315+
command: SHELL_COMMAND,
13141316
description: SHELL_COMMAND,
13151317
parentTaskId: `${CHILD}:call-nested`,
13161318
});
@@ -1339,7 +1341,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
13391341
// The held wake keeps work pending until the reconnect discards it and lists what it kept.
13401342
yield* watch.until(() => watch.state.pending === false || watch.state.roster?.length === 1);
13411343
assert.deepEqual(watch.state.roster, [
1342-
{ taskId: "sh_child", kind: "command", description: SHELL_COMMAND },
1344+
{ taskId: "sh_child", kind: "command", command: SHELL_COMMAND, description: SHELL_COMMAND },
13431345
]);
13441346
yield* watch.until(() => watch.state.variant === "drained");
13451347
assert.isTrue(yield* runtime.hasPendingBackgroundWork!);
@@ -1446,7 +1448,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
14461448
assert.isTrue(yield* runtime.hasPendingBackgroundWork!);
14471449
yield* watch.until(() => watch.state.roster?.length === 1);
14481450
assert.deepEqual(watch.state.roster, [
1449-
{ taskId: "sh_child", kind: "command", description: SHELL_COMMAND },
1451+
{ taskId: "sh_child", kind: "command", command: SHELL_COMMAND, description: SHELL_COMMAND },
14501452
]);
14511453
yield* stop;
14521454
assert.isTrue(gate.hasReached("second"));
@@ -1820,8 +1822,8 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
18201822
(watch.state.roster ?? []).every((task) => (task as { description?: string }).description),
18211823
);
18221824
assert.deepEqual(watch.state.roster, [
1823-
{ taskId: "sh_a", kind: "command", description: SHELL_COMMAND },
1824-
{ taskId: "sh_b", kind: "command", description: SHELL_COMMAND },
1825+
{ taskId: "sh_a", kind: "command", command: SHELL_COMMAND, description: SHELL_COMMAND },
1826+
{ taskId: "sh_b", kind: "command", command: SHELL_COMMAND, description: SHELL_COMMAND },
18251827
]);
18261828
gate.release("ended");
18271829
yield* Deferred.await(continued);
@@ -1850,7 +1852,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
18501852
assert.deepEqual(watch.terminals, ["completed"]);
18511853
yield* watch.until(() => watch.calls.get("Sleep")?.status === "completed");
18521854
assert.deepEqual(watch.state.roster, [
1853-
{ taskId: "sh_child", kind: "command", description: SHELL_COMMAND },
1855+
{ taskId: "sh_child", kind: "command", command: SHELL_COMMAND, description: SHELL_COMMAND },
18541856
]);
18551857
const childTurns = watch.childTurns.size;
18561858
yield* runtime.interruptTurn({
@@ -1894,6 +1896,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
18941896
assert.deepEqual(shell, {
18951897
taskId: "sh_child",
18961898
kind: "command",
1899+
command: SHELL_COMMAND,
18971900
description: SHELL_COMMAND,
18981901
parentTaskId: subagent?.taskId,
18991902
});

‎packages/provider-opencode/src/server/v2/adapter.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,9 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr
13131313
[...session.shells].map(([taskId, shell]) => ({
13141314
taskId,
13151315
kind: "command" as const,
1316-
...(shell.command === undefined ? {} : { description: shell.command }),
1316+
...(shell.command === undefined
1317+
? {}
1318+
: { command: shell.command, description: shell.command }),
13171319
...(session.subagent !== undefined && background.includes(session.subagent.call)
13181320
? { parentTaskId: session.subagent.call.nativeId }
13191321
: {}),

0 commit comments

Comments
 (0)