From 84b4fad75ff92e531c0d0d72b9f7b466cb1a088f Mon Sep 17 00:00:00 2001 From: Arshdeep singh Date: Mon, 14 Sep 2026 22:11:55 +0530 Subject: [PATCH] fix(cli): report call status start as unknown call status reused callStarted: true on every error envelope, including auth_required on a machine that never placed a call. Co-authored-by: Cursor --- .changeset/call-status-started-unknown.md | 5 ++++ packages/cli/docs/cli-reference.md | 5 +++- packages/cli/lib/cli.js | 4 +-- packages/cli/test/cli.test.js | 33 +++++++++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 .changeset/call-status-started-unknown.md diff --git a/.changeset/call-status-started-unknown.md b/.changeset/call-status-started-unknown.md new file mode 100644 index 0000000..9f5812f --- /dev/null +++ b/.changeset/call-status-started-unknown.md @@ -0,0 +1,5 @@ +--- +"@call-e/cli": patch +--- + +Report `call_started: "unknown"` on `call status` failures instead of hardcoding `true`. diff --git a/packages/cli/docs/cli-reference.md b/packages/cli/docs/cli-reference.md index 07b28e6..461e233 100644 --- a/packages/cli/docs/cli-reference.md +++ b/packages/cli/docs/cli-reference.md @@ -175,7 +175,10 @@ first clarification question when available. Call workflow failures include a `stage` of `plan_call`, `run_call`, or `get_call_run`, plus `call_started` and `retry_safe` guidance. A `plan_call` -failure reports `call_started: false` and is safe to retry. If `run_call` may +failure reports `call_started: false` and is safe to retry. A `call status` +(`get_call_run`) failure reports `call_started: "unknown"` and `retry_safe: +true`: a status lookup cannot know whether a call exists, and `true` is +reserved for a stable `run_id` from `run_call`. If `run_call` may have been accepted but no stable `run_id` was received, the CLI reports `call_started: "unknown"`, `retry_safe: false`, an opaque `recovery_id`, and `next_argv`. Use that array as the next request's `argv`, preserving all diff --git a/packages/cli/lib/cli.js b/packages/cli/lib/cli.js index 10bfce7..af50719 100644 --- a/packages/cli/lib/cli.js +++ b/packages/cli/lib/cli.js @@ -1242,7 +1242,7 @@ async function fetchCallStatus({ config, deps, runId }) { deps, stage: "get_call_run", toolArguments: { run_id: runId }, - callStarted: true, + callStarted: "unknown", retrySafe: true, }); } @@ -1508,7 +1508,7 @@ async function handleCallCommand({ command, positional, options, config, deps, s deps, stage: toolName, toolArguments: buildStatusArguments(options), - callStarted: true, + callStarted: "unknown", retrySafe: true, }); localizeCallStatusResultTimestamps(result, options, deps.env || process.env); diff --git a/packages/cli/test/cli.test.js b/packages/cli/test/cli.test.js index 06f8401..e3d149e 100644 --- a/packages/cli/test/cli.test.js +++ b/packages/cli/test/cli.test.js @@ -2090,6 +2090,39 @@ test("call run invokes run_call then get_call_run once", async () => { assert.doesNotMatch(result.stdout, /run-token/); }); +test("call status auth failure reports call_started unknown", async () => { + const cacheRoot = makeTempRoot("calle-cli-call-status-auth"); + let fetchCalled = false; + const result = await run( + [ + "call", + "status", + "--run-id", + "run_does_not_exist", + "--base-url", + "https://mcp.example", + "--cache-root", + cacheRoot, + ], + { + fetchImpl: async () => { + fetchCalled = true; + throw new Error("fetch should not be called"); + }, + } + ); + const payload = JSON.parse(result.stdout); + + assert.equal(result.code, 1); + assert.equal(fetchCalled, false); + assert.equal(payload.ok, false); + assert.equal(payload.error.code, "auth_required"); + assert.equal(payload.stage, "get_call_run"); + assert.equal(payload.call_started, "unknown"); + assert.equal(payload.retry_safe, true); + assert.notEqual(payload.call_started, true); +}); + test("call status maps flags to get_call_run arguments", async () => { const cacheRoot = makeTempRoot("calle-cli-call-status"); const serverUrl = "https://mcp.example/mcp/openagent_oauth";