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, 23:30 UTC
fix(provider-acp-registry): prepared binary agents stay ready when the registry advances (#26543)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 11, 2026 at 11:51 UTC
77d17b157e4583d88531402e7b9232e14dec8088
2 files changed
+100
-12
packages/provider-acp-registry/src/server/AcpRegistrySupport.test.ts
+64
@@ -622,6 +622,70 @@ describe("AcpRegistrySupport", () => {
622
);
623
});
624
625
+ it.effect("keeps a prepared binary ready after the registry advances its version", () => {
626
+ const makeBinaryAgent = (version: string) => ({
627
+ ...makeAgent({
628
+ binary: {
629
+ "linux-x86_64": {
630
+ archive: `https://registry.test/example-agent-${version}.bin`,
631
+ cmd: "./bin/example-agent",
632
+ },
633
+ },
634
+ }),
635
+ version,
636
+ });
637
+ let agent = makeBinaryAgent("1.2.3");
638
+ return Effect.gen(function* () {
639
+ const fileSystem = yield* FileSystem.FileSystem;
640
+ const cacheDir = yield* fileSystem.makeTempDirectoryScoped({
641
+ prefix: "t3-acp-registry-advance-",
642
+ });
643
+ const resolver = yield* AcpRegistrySupport.makeAcpRegistryCatalog({
644
+ cacheDir,
645
+ toolsDir: `${cacheDir}/tools`,
646
+ registryUrl,
647
+ });
648
+ yield* resolver.prepare({ agentId: agent.id });
649
+
650
+ agent = makeBinaryAgent("1.2.4");
651
+ yield* TestClock.adjust("6 minutes");
652
+ yield* resolver.search({ query: "example" });
653
+
654
+ expect(yield* resolver.inspect(settings())).toMatchObject({
655
+ status: "ready",
656
+ distribution: "binary",
657
+ });
658
+ const resolved = yield* resolver.resolve(settings(), "/workspace", {});
659
+ expect(resolved.spawn.command).toContain(
660
+ "/tools/example-agent/1.2.4/linux-x86_64/bin/example-agent",
661
+ );
662
+ expect(yield* fileSystem.readFileString(resolved.spawn.command)).toBe(
663
+ "#!/bin/sh\necho 1.2.4\n",
664
+ );
665
+
666
+ expect(yield* resolver.uninstallManagedBinary({ agentId: agent.id })).toMatchObject({
667
+ removed: true,
668
+ });
669
+ expect(yield* resolver.inspect(settings())).toMatchObject({ status: "unprepared" });
670
+ }).pipe(
671
+ Effect.scoped,
672
+ Effect.provide(
673
+ layerResolver((request) =>
674
+ Effect.succeed(
675
+ HttpClientResponse.fromWeb(
676
+ request,
677
+ new Response(
678
+ request.url === registryUrl
679
+ ? makeRegistry(agent)
680
+ : `#!/bin/sh\necho ${agent.version}\n`,
681
+ ),
682
+ ),
683
+ ),
684
+ ),
685
+ ),
686
+ );
687
+ });
688
+
689
it.effect(
690
"prepares the registry version despite an older PATH binary and permits explicit overrides",
691
() => {
packages/provider-acp-registry/src/server/AcpRegistrySupport.ts
+36
-12
@@ -1393,6 +1393,27 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct
1393
};
1394
};
1395
1396
+ const hasInstalledBinaryVersion = Effect.fn("AcpRegistryCatalog.hasInstalledBinaryVersion")(
1397
+ function* (agentId: string) {
1398
+ const agentRoot = path.join(installsDirectory, agentId);
1399
+ const versions = yield* fileSystem
1400
+ .readDirectory(agentRoot)
1401
+ .pipe(Effect.orElseSucceed((): Array<string> => []));
1402
+ for (const version of versions) {
1403
+ for (const candidateTarget of resolveAcpRegistryPlatformTargetCandidates(platformTarget)) {
1404
+ if (
1405
+ yield* fileSystem
1406
+ .exists(path.join(agentRoot, version, candidateTarget))
1407
+ .pipe(Effect.orElseSucceed(() => false))
1408
+ ) {
1409
+ return true;
1410
+ }
1411
+ }
1412
+ }
1413
+ return false;
1414
+ },
1415
+ );
1416
+
1417
const installBinary = Effect.fn("AcpRegistryCatalog.installBinary")(function* (
1418
agent: AcpRegistryAgent,
1419
target: typeof AcpRegistryBinaryTarget.Type,
@@ -1773,7 +1794,8 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct
1794
const exists = yield* fileSystem
1795
.exists(paths.executablePath)
1796
.pipe(Effect.orElseSucceed(() => false));
1776
- if (!exists) {
1797
+ // Any prepared version keeps the agent ready; resolve installs the current one on demand.
1798
+ if (!exists && !(yield* hasInstalledBinaryVersion(agent.id))) {
1799
return {
1800
status: "unprepared",
1801
agentId,
@@ -1781,17 +1803,19 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct
1803
distribution: "binary",
1804
} as const;
1805
}
1784
- yield* assertExecutableInRoot(paths.installRoot, paths.executablePath).pipe(
1785
- Effect.mapError((cause) =>
1786
- isAcpRegistryError(cause)
1787
- ? cause
1788
- : new AcpRegistryError({
1789
- reason: "install_failed",
1790
- detail: `Could not validate cached ACP Registry agent ${agent.id}.`,
1791
- cause,
1792
- }),
1793
- ),
1794
- );
1806
+ if (exists) {
1807
+ yield* assertExecutableInRoot(paths.installRoot, paths.executablePath).pipe(
1808
+ Effect.mapError((cause) =>
1809
+ isAcpRegistryError(cause)
1810
+ ? cause
1811
+ : new AcpRegistryError({
1812
+ reason: "install_failed",
1813
+ detail: `Could not validate cached ACP Registry agent ${agent.id}.`,
1814
+ cause,
1815
+ }),
1816
+ ),
1817
+ );
1818
+ }
1819
return {
1820
status: "ready",
1821
agentId,