fix(agents/harness): pass CLI runtime aliases through to PI in select… · openclaw/openclaw@2c3b7ea
potterdigita
·
2026-05-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -675,4 +675,61 @@ describe("selectAgentHarness", () => {
|
675 | 675 | failure: { reason: "unsupported_harness_compaction" }, |
676 | 676 | }); |
677 | 677 | }); |
| 678 | + |
| 679 | +it.each([ |
| 680 | +{ provider: "anthropic", modelId: "sonnet-4.6", alias: "claude-cli" }, |
| 681 | +{ provider: "google", modelId: "gemini-3-pro-preview", alias: "google-gemini-cli" }, |
| 682 | +])( |
| 683 | +"returns PI for explicit CLI runtime alias $alias on $provider instead of throwing MissingAgentHarnessError", |
| 684 | +({ provider, modelId, alias }) => { |
| 685 | +expect( |
| 686 | +selectAgentHarness({ |
| 687 | + provider, |
| 688 | + modelId, |
| 689 | +agentHarnessRuntimeOverride: alias, |
| 690 | +}).id, |
| 691 | +).toBe("pi"); |
| 692 | +}, |
| 693 | +); |
| 694 | + |
| 695 | +it("still throws MissingAgentHarnessError for an explicit configured cliBackends id", () => { |
| 696 | +const config = { |
| 697 | +agents: { |
| 698 | +defaults: { |
| 699 | +cliBackends: { |
| 700 | +"my-custom-cli": { command: "echo" }, |
| 701 | +}, |
| 702 | +}, |
| 703 | +}, |
| 704 | +} as OpenClawConfig; |
| 705 | + |
| 706 | +expect(() => |
| 707 | +selectAgentHarness({ |
| 708 | +provider: "anthropic", |
| 709 | +modelId: "sonnet-4.6", |
| 710 | +agentHarnessRuntimeOverride: "my-custom-cli", |
| 711 | + config, |
| 712 | +}), |
| 713 | +).toThrow('Requested agent harness "my-custom-cli" is not registered'); |
| 714 | +}); |
| 715 | + |
| 716 | +it("still throws MissingAgentHarnessError for an explicit non-CLI unknown runtime", () => { |
| 717 | +expect(() => |
| 718 | +selectAgentHarness({ |
| 719 | +provider: "anthropic", |
| 720 | +modelId: "sonnet-4.6", |
| 721 | +agentHarnessRuntimeOverride: "clade-cli", |
| 722 | +}), |
| 723 | +).toThrow('Requested agent harness "clade-cli" is not registered'); |
| 724 | +}); |
| 725 | + |
| 726 | +it("still throws MissingAgentHarnessError for an explicit CLI alias owned by another provider", () => { |
| 727 | +expect(() => |
| 728 | +selectAgentHarness({ |
| 729 | +provider: "anthropic", |
| 730 | +modelId: "sonnet-4.6", |
| 731 | +agentHarnessRuntimeOverride: "google-gemini-cli", |
| 732 | +}), |
| 733 | +).toThrow('Requested agent harness "google-gemini-cli" is not registered'); |
| 734 | +}); |
678 | 735 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。