@devries-cameron20 / t3code Mirror · read-only / commits / 781ab0553c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 11:00 UTC

fix(acp-registry): a failed agent install no longer floods provider status with its whole log (#32800)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Victor committed Nov 15, 2026 at 00:55 UTC 781ab0553ca5e5a6040f182b1f04335546e264f9
3 files changed +48 -2
packages/provider-acp-registry/src/server/AcpRegistrySupport.test.ts
+33
@@ -561,6 +561,39 @@ describe("AcpRegistrySupport", () => {
561 );
562 });
563
564 + it.effect("keeps only the end of a failed install's output in its error", () => {
565 + const agent = makeAgent({ npx: { package: "@example/acp@1.2.3" } });
566 + return Effect.gen(function* () {
567 + const fileSystem = yield* FileSystem.FileSystem;
568 + const cacheDir = yield* fileSystem.makeTempDirectoryScoped({
569 + prefix: "t3-acp-registry-failed-install-",
570 + });
571 + const toolchain = yield* makeFakeNpmToolchain(cacheDir);
572 + const environment = { ...toolchain.environment, FAKE_NPM_INSTALL_FAILURE_LINES: "40000" };
573 + const resolver = yield* AcpRegistrySupport.makeAcpRegistryCatalog({
574 + cacheDir,
575 + toolsDir: `${cacheDir}/tools`,
576 + registryUrl,
577 + }).pipe(Effect.provideService(HostProcess.Environment, environment));
578 +
579 + const error = yield* resolver
580 + .resolve(settings(), "/workspace", environment)
581 + .pipe(Effect.flip);
582 +
583 + expect(error.reason).toBe("install_failed");
584 + expect(error.detail).toContain("exited with code 1");
585 + expect(error.detail).toMatch(/npm error see the complete log for details$/u);
586 + expect(error.detail.split("exited with code 1: ")[1]?.length).toBeLessThanOrEqual(1_000);
587 + }).pipe(
588 + Effect.scoped,
589 + Effect.provide(
590 + layerResolver((request) =>
591 + Effect.succeed(HttpClientResponse.fromWeb(request, new Response(makeRegistry(agent)))),
592 + ),
593 + ),
594 + );
595 + });
596 +
597 it.effect("launches the managed uv command over a PATH command named after the agent", () => {
598 const agent = makeAgent({
599 uvx: { package: "fast-agent-acp==0.10.1", args: ["--acp"] },
packages/provider-acp-registry/src/server/AcpRegistrySupport.ts
+10 -2
@@ -53,6 +53,8 @@ const ACP_REGISTRY_URL = "https://cdn.agentclientprotocol.com/registry/v1/latest
53 const MAX_REGISTRY_BYTES = 1024 * 1024;
54 const MAX_ARCHIVE_BYTES = 1024 * 1024 * 1024;
55 const MAX_COMMAND_OUTPUT_BYTES = 1024 * 1024;
56 +// Install errors become the provider status message; npm and uv print the actionable error last.
57 +const MAX_COMMAND_ERROR_TAIL_CHARS = 1_000;
58 // Archive listings can exceed the output of package-manager commands.
59 const MAX_ARCHIVE_LISTING_BYTES = 64 * 1024 * 1024;
60 const MAX_PACKAGE_MANIFEST_BYTES = 1024 * 1024;
@@ -951,7 +953,13 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct
953 stream: child.stdout,
954 maxBytes: options.maxStdoutBytes ?? MAX_COMMAND_OUTPUT_BYTES,
955 }),
954 - collectUint8StreamText({ stream: child.stderr, maxBytes: MAX_COMMAND_OUTPUT_BYTES }),
956 + child.stderr.pipe(
957 + Stream.decodeText(),
958 + Stream.runFold(
959 + () => "",
960 + (tail, text) => `${tail}${text}`.slice(-MAX_COMMAND_ERROR_TAIL_CHARS),
961 + ),
962 + ),
963 child.exitCode,
964 ],
965 { concurrency: "unbounded" },
@@ -959,7 +967,7 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct
967 if (Number(exitCode) !== 0) {
968 return yield* new AcpRegistryError({
969 reason: "install_failed",
962 - detail: `ACP Registry install command '${command}' exited with code ${Number(exitCode)}: ${stderr.text.trim()}`,
970 + detail: `ACP Registry install command '${command}' exited with code ${Number(exitCode)}: ${stderr.trim()}`,
971 });
972 }
973 // Truncated listings would bypass archive traversal validation.
packages/provider-acp-registry/src/server/testing/AcpRegistrySupport.npm.fixture.sh
+5
@@ -10,6 +10,11 @@ if [ "$1" = "prefix" ] && [ "$2" = "--global" ]; then
10 exit 0
11 fi
12 if [ "$1" = "install" ] && [ "$2" = "--global" ]; then
13 + if [ -n "$FAKE_NPM_INSTALL_FAILURE_LINES" ]; then
14 + yes 'npm notice resolving example dependency' | head -n "$FAKE_NPM_INSTALL_FAILURE_LINES" >&2
15 + printf '%s\n' 'npm error see the complete log for details' >&2
16 + exit 1
17 + fi
18 package_root="$prefix/lib/node_modules/@example/acp"
19 executable="$prefix/bin/example-agent"
20 mkdir -p "$package_root" "$prefix/bin"