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(acp): a blank line from an ACP agent no longer ends the session (… · pingdotgg/t3code@db0ae7b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/effect-acp/src
    • protocol.test.ts
    • protocol.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/effect-acp/src/protocol.test.ts‎

Copy file name to clipboardExpand all lines: packages/effect-acp/src/protocol.test.ts
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,31 @@ it.layer(NodeServices.layer)("effect-acp protocol", (it) => {
531531
}),
532532
);
533533

534+
it.effect("skips blank lines between agent messages", () =>
535+
Effect.gen(function* () {
536+
const { stdio, input } = yield* makeInMemoryStdio();
537+
const outcome = yield* Deferred.make<string>();
538+
const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
539+
stdio,
540+
serverRequestMethods: new Set(),
541+
onTermination: (error) => Deferred.succeed(outcome, error._tag).pipe(Effect.asVoid),
542+
});
543+
yield* transport.incoming.pipe(
544+
Stream.runForEach((notification) => Deferred.succeed(outcome, notification._tag)),
545+
Effect.forkScoped,
546+
);
547+
548+
const update = encodeUnknownJsonString({
549+
jsonrpc: "2.0",
550+
method: "session/update",
551+
params: { sessionId: "session-1", update: { sessionUpdate: "plan", entries: [] } },
552+
});
553+
yield* Queue.offer(input, encoder.encode(`\n\r\n \t\n${update}\n\n`));
554+
555+
assert.equal(yield* Deferred.await(outcome), "SessionUpdate");
556+
}),
557+
);
558+
534559
it.effect("logs decode failures without copying the cause or wire payload", () =>
535560
Effect.gen(function* () {
536561
const secret = "acp-wire-secret-sentinel";
Collapse file

‎packages/effect-acp/src/protocol.ts‎

Copy file name to clipboardExpand all lines: packages/effect-acp/src/protocol.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const decodeElicitationComplete = Schema.decodeUnknownEffect(
173173
);
174174
const parserFactory = RpcSerialization.ndJsonRpc();
175175
// ndJsonRpc skips lines that are not JSON. A malformed agent line has to end the
176-
// session, so frames are split here and each one goes through the strict codec.
176+
// session, so frames are split here and each nonblank one goes through the strict codec.
177177
const makeStrictNdJsonRpcParser = () => {
178178
const codec = RpcSerialization.jsonRpc().makeUnsafe();
179179
const decoder = new TextDecoder();
@@ -197,7 +197,7 @@ const makeStrictNdJsonRpcParser = () => {
197197
}
198198
const lines = (buffer + chunk.slice(0, lastNewline)).split("\n");
199199
buffer = chunk.slice(lastNewline + 1);
200-
return lines.flatMap(decodeLine);
200+
return lines.flatMap((line) => (line.trim() === "" ? [] : decodeLine(line)));
201201
},
202202
// A truncated final line is left to the exit status, which explains a crash better.
203203
end: (): ReadonlyArray<AcpDecodedWireMessage> => {

0 commit comments

Comments
0 (0)
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.