mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:20:44 +00:00
fix(agents): keep claude live streams valid
This commit is contained in:
@@ -15,6 +15,7 @@ Docs: https://docs.openclaw.ai
|
|||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
- Gateway/models: move local-provider pricing opt-outs, OpenRouter/LiteLLM aliases, and proxy passthrough pricing lookup into plugin manifest metadata so core no longer carries extension-specific pricing tables. Thanks @codex.
|
- Gateway/models: move local-provider pricing opt-outs, OpenRouter/LiteLLM aliases, and proxy passthrough pricing lookup into plugin manifest metadata so core no longer carries extension-specific pricing tables. Thanks @codex.
|
||||||
|
- Agents/Claude CLI: force live-session launches to include `--output-format stream-json` whenever OpenClaw adds `--input-format stream-json`, so new Claude CLI sessions no longer fail immediately while reusable sessions keep working. Fixes #72206. Thanks @kwangwonkoh and @Xivi08.
|
||||||
- CLI/plugins: accept ClawHub plugin API wildcard ranges such as `*` without rejecting compatible plugin installs, while still requiring a valid runtime API version. Fixes #56446; supersedes #56466. Thanks @darconada and @claygeo.
|
- CLI/plugins: accept ClawHub plugin API wildcard ranges such as `*` without rejecting compatible plugin installs, while still requiring a valid runtime API version. Fixes #56446; supersedes #56466. Thanks @darconada and @claygeo.
|
||||||
- Agents/sessions: acquire the session write lock only after cold bootstrap, plugin, and tool setup so fallback runs are not blocked by stalled pre-model startup work. Thanks @codex.
|
- Agents/sessions: acquire the session write lock only after cold bootstrap, plugin, and tool setup so fallback runs are not blocked by stalled pre-model startup work. Thanks @codex.
|
||||||
- Browser/plugins: auto-start the bundled browser plugin when root `browser` config is present, including restrictive plugin allowlists, and ignore stale persisted plugin registries whose package paths no longer exist. Thanks @codex.
|
- Browser/plugins: auto-start the bundled browser plugin when root `browser` config is present, including restrictive plugin allowlists, and ignore stale persisted plugin registries whose package paths no longer exist. Thanks @codex.
|
||||||
|
|||||||
@@ -786,14 +786,7 @@ describe("runCliAgent spawn path", () => {
|
|||||||
runId: "run-live-1",
|
runId: "run-live-1",
|
||||||
prompt: "first",
|
prompt: "first",
|
||||||
backend: {
|
backend: {
|
||||||
args: [
|
args: ["-p", "--strict-mcp-config", "--mcp-config", "/tmp/mcp-one.json"],
|
||||||
"-p",
|
|
||||||
"--output-format",
|
|
||||||
"stream-json",
|
|
||||||
"--strict-mcp-config",
|
|
||||||
"--mcp-config",
|
|
||||||
"/tmp/mcp-one.json",
|
|
||||||
],
|
|
||||||
liveSession: "claude-stdio",
|
liveSession: "claude-stdio",
|
||||||
},
|
},
|
||||||
mcpConfigHash: "same-mcp-config",
|
mcpConfigHash: "same-mcp-config",
|
||||||
@@ -806,14 +799,7 @@ describe("runCliAgent spawn path", () => {
|
|||||||
runId: "run-live-2",
|
runId: "run-live-2",
|
||||||
prompt: "second",
|
prompt: "second",
|
||||||
backend: {
|
backend: {
|
||||||
args: [
|
args: ["-p", "--strict-mcp-config", "--mcp-config", "/tmp/mcp-two.json"],
|
||||||
"-p",
|
|
||||||
"--output-format",
|
|
||||||
"stream-json",
|
|
||||||
"--strict-mcp-config",
|
|
||||||
"--mcp-config",
|
|
||||||
"/tmp/mcp-two.json",
|
|
||||||
],
|
|
||||||
liveSession: "claude-stdio",
|
liveSession: "claude-stdio",
|
||||||
},
|
},
|
||||||
mcpConfigHash: "same-mcp-config",
|
mcpConfigHash: "same-mcp-config",
|
||||||
@@ -829,6 +815,7 @@ describe("runCliAgent spawn path", () => {
|
|||||||
expect(supervisorSpawnMock).toHaveBeenCalledOnce();
|
expect(supervisorSpawnMock).toHaveBeenCalledOnce();
|
||||||
expect(spawnInput.stdinMode).toBe("pipe-open");
|
expect(spawnInput.stdinMode).toBe("pipe-open");
|
||||||
expect(spawnInput.argv).toContain("--input-format");
|
expect(spawnInput.argv).toContain("--input-format");
|
||||||
|
expect(spawnInput.argv).toContain("--output-format");
|
||||||
expect(spawnInput.argv).toContain("stream-json");
|
expect(spawnInput.argv).toContain("stream-json");
|
||||||
expect(spawnInput.argv).toContain("--replay-user-messages");
|
expect(spawnInput.argv).toContain("--replay-user-messages");
|
||||||
expect(spawnInput.argv).not.toContain("--session-id");
|
expect(spawnInput.argv).not.toContain("--session-id");
|
||||||
@@ -1214,6 +1201,36 @@ describe("runCliAgent spawn path", () => {
|
|||||||
expect(args).not.toContain("current prompt");
|
expect(args).not.toContain("current prompt");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("adds Claude stream-json output format when building live session argv", () => {
|
||||||
|
const backend: PreparedCliRunContext["preparedBackend"]["backend"] = {
|
||||||
|
command: "claude",
|
||||||
|
args: ["-p"],
|
||||||
|
output: "jsonl",
|
||||||
|
input: "stdin",
|
||||||
|
sessionArg: "--session-id",
|
||||||
|
systemPromptArg: "--append-system-prompt",
|
||||||
|
systemPromptFileArg: "--append-system-prompt-file",
|
||||||
|
};
|
||||||
|
|
||||||
|
const args = buildClaudeLiveArgs({
|
||||||
|
args: ["-p"],
|
||||||
|
backend,
|
||||||
|
systemPrompt: "current prompt",
|
||||||
|
useResume: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(args).toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
|
"--input-format",
|
||||||
|
"stream-json",
|
||||||
|
"--output-format",
|
||||||
|
"stream-json",
|
||||||
|
"--permission-prompt-tool",
|
||||||
|
"stdio",
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("restarts Claude live sessions for env changes and fresh retries", async () => {
|
it("restarts Claude live sessions for env changes and fresh retries", async () => {
|
||||||
const cancels: Array<ReturnType<typeof vi.fn>> = [];
|
const cancels: Array<ReturnType<typeof vi.fn>> = [];
|
||||||
const turnResults = ["first-ok", "resume-ok", "env-ok", "fresh-ok"];
|
const turnResults = ["first-ok", "resume-ok", "env-ok", "fresh-ok"];
|
||||||
|
|||||||
@@ -147,8 +147,12 @@ export function buildClaudeLiveArgs(params: {
|
|||||||
return appendArg(
|
return appendArg(
|
||||||
upsertArgValue(
|
upsertArgValue(
|
||||||
upsertArgValue(
|
upsertArgValue(
|
||||||
stripLiveProcessArgs(params.args, params.backend, params.useResume),
|
upsertArgValue(
|
||||||
"--input-format",
|
stripLiveProcessArgs(params.args, params.backend, params.useResume),
|
||||||
|
"--input-format",
|
||||||
|
"stream-json",
|
||||||
|
),
|
||||||
|
"--output-format",
|
||||||
"stream-json",
|
"stream-json",
|
||||||
),
|
),
|
||||||
"--permission-prompt-tool",
|
"--permission-prompt-tool",
|
||||||
|
|||||||
Reference in New Issue
Block a user