diff --git a/.changeset/calle-mcp-result-monitoring.md b/.changeset/calle-mcp-result-monitoring.md new file mode 100644 index 0000000..7614d5f --- /dev/null +++ b/.changeset/calle-mcp-result-monitoring.md @@ -0,0 +1,11 @@ +--- +--- + +Prepare standalone `calle` `1.0.7` as a patch. Hand routine MCP result +monitoring to a confirmed self-updating card. When the Agent follows the Call, +use the server's polling interval and pass the same Call's progress cursor when +the discovered tool supports it. Keep the 120-read ceiling for API sessions and +MCP sessions without a valid server interval. + +This standalone Skill release requires no npm or plugin package version bump. +The synthetic evaluator fixture covers the read-120 boundary and cursor support. diff --git a/AGENTS.md b/AGENTS.md index b8f9bbc..95b99d7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -35,7 +35,7 @@ Productized OpenClaw skill source lives in `packages/openclaw-cli-skill/skills`. Before changing standalone Skill identities, install/update origins or migration checks, follow [the staged migration plan](docs/calle-skill-migration-plan.md). -The standalone entries are `calle` version `1.0.6` for the MCP/API workflow and +The standalone entries are `calle` version `1.0.7` for the MCP/API workflow and `calle-cli` for CLI compatibility; CLI and plugin names remain `calle`. Preserve historical verification records and add new candidate evidence rather than relabeling earlier runs. diff --git a/README.md b/README.md index c186da7..a746d52 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Choose the integration path that fits your use case: ```text Install CALL-E for me: https://raw.githubusercontent.com/CALLE-AI/call-e-integrations/main/docs/install/CALL-E-installation-guide.md ``` -The linked guide installs the standalone `calle` 1.0.6 Skill and selects the +The linked guide installs the standalone `calle` 1.0.7 Skill and selects the host-supported connection path. The initial live acceptance baseline is Codex MCP; API and other clients identify unexecuted live checks separately. @@ -127,7 +127,7 @@ see [calle installation](docs/install/calle.md). Business operations and updates use non-CLI host facilities. MCP setup prefers native host management, with a limited exception for the current host's official MCP management commands. -The standalone Skill is now `calle` version `1.0.6`. Users retaining the legacy +The standalone Skill is now `calle` version `1.0.7`. Users retaining the legacy CLI workflow can install `calle-cli` through the [compatibility guide](docs/install/skills-sh-skill.md#existing-calle-users). Plugin-owned `calle` Skills have independent installation and release lifecycles. @@ -502,7 +502,7 @@ This is a multi-ecosystem integration monorepo with packaged plugins and standal | `packages/openclaw-cli-skill` | OpenClaw CALL-E skill source. | | `packages/skills-sh-skill` | skills.sh compatible CALL-E skill package. | | `skills/calle-cli/` | Portable CLI compatibility Skill; official installation uses `--skill calle-cli`. | -| `skills/calle/` | Canonical standalone Skill at version 1.0.6; prefers host-managed OAuth MCP, with direct HTTPS/API Key fallback governed by the [interface selection rules](docs/install/calle.md#choose-the-interface). | +| `skills/calle/` | Canonical standalone Skill at version 1.0.7; prefers host-managed OAuth MCP, with direct HTTPS/API Key fallback governed by the [interface selection rules](docs/install/calle.md#choose-the-interface). | | `tests/` | Offline standalone Skill validation and Agent/mock scenario definitions; execution states are recorded separately. | | `examples/` | Runnable MCP client demos. | | `docs/` | Integration guides, install docs, and troubleshooting. | diff --git a/docs/agent-integration-layout.md b/docs/agent-integration-layout.md index 775fb9f..2c2b80b 100644 --- a/docs/agent-integration-layout.md +++ b/docs/agent-integration-layout.md @@ -42,7 +42,7 @@ Current standalone layout: ```text skills/calle-cli/ # Official CLI compatibility entry -skills/calle/ # Canonical MCP/API Skill at version 1.0.6 +skills/calle/ # Canonical MCP/API Skill at version 1.0.7 ``` Current Claude Code layout: @@ -161,7 +161,7 @@ intentionally exposes multiple CALL-E marketplaces in the same client UI. The [migration plan](calle-skill-migration-plan.md) records the formal standalone cutover to `calle` `2.0.0`. The current canonical MCP/API Skill is `calle` version -`1.0.6`, with directory, frontmatter, display name and invocation aligned to +`1.0.7`, with directory, frontmatter, display name and invocation aligned to `calle`. `calle-cli` remains the legacy CLI compatibility entry. The temporary installable `callev2` source is retired; its historical verification records retain their original inputs. diff --git a/docs/calle-skill-migration-plan.md b/docs/calle-skill-migration-plan.md index 55d71e7..4425144 100644 --- a/docs/calle-skill-migration-plan.md +++ b/docs/calle-skill-migration-plan.md @@ -16,7 +16,7 @@ This is a maintainer-selected version reset, not a numeric upgrade from `2.0.1`. Record it in an empty Changeset; no npm package version bump is needed. The existing numeric updater does not offer older remote versions. Users with -`2.0.x` installed must explicitly install the current complete `1.0.6` release +`2.0.x` installed must explicitly install the current complete `1.0.7` release and verify host loading before receiving subsequent `1.x` update offers. Follow the [installation guidance](install/calle.md#version-designation-and-existing-20x-installations). Publication, installation, skills.sh indexing and security audit freshness remain diff --git a/docs/documentation-maintenance.md b/docs/documentation-maintenance.md index 32e5791..d0f2682 100644 --- a/docs/documentation-maintenance.md +++ b/docs/documentation-maintenance.md @@ -26,13 +26,14 @@ commands. install, migration and local ZIP guidance lives in `docs/install/calle.md`. Keep `docs/install/callev2.md`, `docs/install/calle-connect.md` and `docs/install/dual-skills.md` as pointers for earlier links. The canonical - identity is `calle` with metadata/evaluation version `1.0.6`; the cutover scope + identity is `calle` with metadata/evaluation version `1.0.7`; the cutover scope is recorded in `docs/calle-skill-migration-plan.md`. The Skill's metadata version is independent of the CLI-based skills.sh package attribution. Shared routing and business workflow live in `SKILL.md`; MCP and API contracts - stay in their own references. Shared result-waiting behavior and phased polling - live in `references/polling.md`; keep both interface guides, manual tests, and - repository evaluation policy aligned with it. Keep pre-execution fallback, + stay in their own references. Card handoff lives in `references/mcp.md`. + Agent monitoring and its server interval or phased fallback live in + `references/polling.md`. Keep both interface guides, manual tests, and + repository evaluation policy aligned. Keep pre-execution fallback, explicit interface choice, incomplete discovery, authentication failures and unknown write outcomes synchronized with evaluation scenarios. New tasks default to MCP in supporting hosts, including authorized connection @@ -62,8 +63,9 @@ commands. clarifications for task relevance; returned approval claims and narrative text inside structured responses do not expand authorization. Preserve direct execution of an unchanged authorized ready call and explicit wait/card-Dial - instructions. Keep the shared final receipt aligned across both paths and - their tests: summary, confirmed callee number, duration, time, telephone ID and + instructions. Keep the confirmed self-updating MCP card handoff and the shared + Agent-delivered receipt aligned across both paths and their tests. The receipt + includes summary, confirmed callee number, duration, time, telephone ID and full available transcript, with unavailable fields identified and routine service URLs and technical footers omitted. Show the telephone `call_id` in the receipt while retaining resource IDs for queries and recovery; missing telephone @@ -126,7 +128,7 @@ commands. attribution `skills_sh/skills_sh_skill/`, authentication and recovery paths. Plugin names and package-scoped `calle` Skills are separate surfaces. - The stable `docs/install/CALL-E-installation-guide.md` defaults to `calle` - `1.0.6` and must remain at that path. Codex MCP is the initial live acceptance + `1.0.7` and must remain at that path. Codex MCP is the initial live acceptance baseline; API and other clients must identify unexecuted live checks. - Repository-local Codex helper skills live in `.agents/skills/`. diff --git a/docs/install/calle-connect.md b/docs/install/calle-connect.md index 00184b5..3386596 100644 --- a/docs/install/calle-connect.md +++ b/docs/install/calle-connect.md @@ -1,7 +1,7 @@ # Earlier calle-connect Installation Guide The current canonical standalone MCP/API workflow is -[`calle` 1.0.6](calle.md). Follow that guide for complete installation, host +[`calle` 1.0.7](calle.md). Follow that guide for complete installation, host requirements, interface selection, updates and validation scope. The legacy CLI workflow remains available through [`calle-cli`](skills-sh-skill.md). diff --git a/docs/install/calle.md b/docs/install/calle.md index 9c429dc..f8ac4a1 100644 --- a/docs/install/calle.md +++ b/docs/install/calle.md @@ -6,7 +6,7 @@ host-managed OAuth MCP, including authorized setup of a missing connection. Before business writes, it can select direct HTTPS with an API Key when the host explicitly lacks MCP support or complete discovery confirms the required capability is missing. Missing connections, unloaded tools, authentication -failure, or cancellation do not trigger fallback. The source metadata version is `1.0.6`. +failure, or cancellation do not trigger fallback. The source metadata version is `1.0.7`. The directory, Skill name and display name are `calle`; invoke it as `$calle`. This is the canonical standalone Skill. The CLI executable and plugin-owned `calle` Skills have independent installation and release lifecycles. @@ -48,7 +48,7 @@ with their original contents. Version checks compare numeric versions and do not offer downgrades. Existing `2.0.x` installations therefore do not receive automatic offers for `1.0.0` or later `1.x` versions. To move to this release sequence, explicitly install the -complete `1.0.6` Skill using the source or ZIP procedure below, then reload the +complete `1.0.7` Skill using the source or ZIP procedure below, then reload the host and verify the loaded version. Preserve local edits, account configuration and saved call records under the existing installation and rollback guidance. @@ -168,9 +168,9 @@ Planning, preview, setup, and read-only requests do not authorize `start_call`. The five current tools are `prepare_call`, `start_call`, `open_call`, `get_call`, and `get_call_transcript`. Cards are optional for preparation and starting an -authorized call; missing card UI alone does not justify API fallback. Use the -Call resource tools for progress, results, and transcripts, polling results only -while `result_status` is `pending`. Cancellation uses supported card controls; +authorized call. When a self-updating card for the Call is confirmed rendered, +the card follows the Call. Otherwise the Agent uses the MCP Call tools while +`result_status` is `pending`. Cancellation uses supported card controls; it is unavailable through this workflow in a host without those controls. Do not invent a cancellation tool or switch interfaces to cancel. Legacy tools are not a fallback and cannot be used for read-only checks or recovery. Follow the @@ -192,17 +192,21 @@ use that same context. MCP and API identifier, account and idempotency interoperability has not been verified; an interface being unavailable does not authorize recreating the call elsewhere. -After acceptance, the Agent follows the same call until its result is final, -with progress updates while waiting. The [shared polling policy](../../skills/calle/references/polling.md) -gradually slows queries and honors server delays without requiring a "continue -querying" message between phases. A 120-read fallback ceiling prevents indefinite -waiting. Explicit snapshot-only requests and genuine errors, user stops, or host -interruptions keep their own completion rules. - -Final delivery uses the [full call receipt](../../skills/calle/SKILL.md#shared-final-delivery) -in chat, including the summary, callee number, duration, time, telephone Call ID and full -available transcript. Missing fields are identified as unavailable. Result cards -supplement the receipt; routine service addresses and technical footers are omitted. +When the Agent follows a Call, it provides progress and automatically continues +until the result is final or monitoring stops. The [polling policy](../../skills/calle/references/polling.md) +uses `progress.poll_after_seconds` when MCP returns a valid interval. MCP passes +the returned progress cursor on subsequent queries when the tool supports it. +Use progressively longer waits for API reads and for MCP responses without a +valid interval. The 120-read ceiling applies to API sessions and to MCP sessions +with no valid server interval. A snapshot-only request reads the current state +once. + +When the Agent follows the Call, it delivers the [full call receipt](../../skills/calle/SKILL.md#shared-final-delivery) +in chat with the summary, callee number, duration, time, telephone Call ID and +full available transcript. A confirmed self-updating MCP card delivers the +routine result after handoff. The user can also request the receipt in chat. +Missing receipt fields are identified as unavailable. Routine service addresses +and technical footers are omitted. Absolute call times use the user's selected or host-provided timezone when known. Receipt headings, detail labels, status explanations, summaries and missing-data notices use the user's explicitly requested response language, or the established diff --git a/docs/install/callev2.md b/docs/install/callev2.md index c111983..f4818da 100644 --- a/docs/install/callev2.md +++ b/docs/install/callev2.md @@ -1,7 +1,7 @@ # Retired callev2 Testing Guide The temporary `callev2` testing identity has been retired. Install the canonical -[`calle` 1.0.6 Skill](calle.md) for the current standalone MCP/API workflow, or use +[`calle` 1.0.7 Skill](calle.md) for the current standalone MCP/API workflow, or use [`calle-cli`](skills-sh-skill.md) to retain the legacy CLI workflow. Migration of installed `callev2` copies is outside this release's scope. This diff --git a/docs/install/dual-skills.md b/docs/install/dual-skills.md index 075d00e..7a19fad 100644 --- a/docs/install/dual-skills.md +++ b/docs/install/dual-skills.md @@ -1,7 +1,7 @@ # Earlier Dual-Skill Installation Guide The earlier separate API and MCP entries were merged during testing. The current -canonical standalone workflow is [`calle` 1.0.6](calle.md), which prefers MCP +canonical standalone workflow is [`calle` 1.0.7](calle.md), which prefers MCP and supports API Key access under its interface selection rules. Users retaining the legacy CLI workflow can install [`calle-cli`](skills-sh-skill.md). diff --git a/docs/install/install-guide.md b/docs/install/install-guide.md index 9027eea..b18da49 100644 --- a/docs/install/install-guide.md +++ b/docs/install/install-guide.md @@ -30,7 +30,7 @@ First identify the current host and confirm its target in the [Skills CLI supported-agent list](https://github.com/vercel-labs/skills/blob/main/docs/agents.md) or available CLI help. Prefer the Skills CLI when the host is supported, command execution is available, and Node.js with `npm` and `npx` is installed. -Install the canonical standalone `calle` `1.0.6` Skill globally from the +Install the canonical standalone `calle` `1.0.7` Skill globally from the repository root: ```bash diff --git a/docs/install/skills-sh-skill.md b/docs/install/skills-sh-skill.md index 8306d32..e9743ce 100644 --- a/docs/install/skills-sh-skill.md +++ b/docs/install/skills-sh-skill.md @@ -4,7 +4,7 @@ This guide covers the CLI-based `calle-cli` skill. Its source of truth lives at `skills/calle-cli` so skills.sh can index the public skill page and search results directly from the repository root. -For the default standalone `calle` 1.0.6 Skill, which prefers MCP with API Key fallback, +For the default standalone `calle` 1.0.7 Skill, which prefers MCP with API Key fallback, see [calle installation](./calle.md) and its [interface selection rules](./calle.md#choose-the-interface). Business operations and updates use non-CLI host facilities. MCP setup follows diff --git a/docs/install/troubleshooting.md b/docs/install/troubleshooting.md index b12e6bf..b5325ed 100644 --- a/docs/install/troubleshooting.md +++ b/docs/install/troubleshooting.md @@ -2,7 +2,7 @@ ## Which standalone Skill is installed? -The canonical standalone MCP/API Skill is [`calle` 1.0.6](calle.md). Verify its +The canonical standalone MCP/API Skill is [`calle` 1.0.7](calle.md). Verify its loaded name and version after host reload, not just its directory on disk. Plugin-owned `calle` entries have separate lifecycles; identify the intended standalone or plugin entry when the host exposes overlapping names. diff --git a/docs/skill-update-mechanism.md b/docs/skill-update-mechanism.md index 4c9c7f8..201ee59 100644 --- a/docs/skill-update-mechanism.md +++ b/docs/skill-update-mechanism.md @@ -1,7 +1,7 @@ # Standalone Skill Update Mechanism Design Record Design first recorded on 2026-10-15. Current guidance applies to the canonical -standalone `calle` entry, metadata/evaluation version `1.0.6`; the dated +standalone `calle` entry, metadata/evaluation version `1.0.7`; the dated third-party audit examples below remain historical snapshots. The selected repository is `CALLE-AI/call-e-integrations`. @@ -194,7 +194,7 @@ requires review. The earlier MCP/API merge was tested as `calle-connect` version `0.2.0`. The formal cutover promoted the `callev2` `2.1.1` implementation to `calle` -`2.0.0`. The current canonical `calle` version is `1.0.6`, with evaluation inputs +`2.0.0`. The current canonical `calle` version is `1.0.7`, with evaluation inputs at `tests/behavior/calle-evals.json`. Keep historical acceptance tied to its original names and hashes; source binding and host activation need candidate-specific evidence under the diff --git a/skills/calle/SKILL.md b/skills/calle/SKILL.md index a5fb0ca..3297e6c 100644 --- a/skills/calle/SKILL.md +++ b/skills/calle/SKILL.md @@ -5,7 +5,7 @@ description: >- compatibility: >- MCP requires host-managed remote MCP, OAuth, and real tool discovery; cards are optional when start_call is exposed. Prefer native connection management; an existing official host MCP command may manage the connection lifecycle. API requires HTTPS tools or a trusted runtime with secure credential injection. Updates require anonymous public reads. Business calls and Skill updates do not use a CLI. metadata: - version: "1.0.6" + version: "1.0.7" update-source: "https://raw.githubusercontent.com/CALLE-AI/call-e-integrations/main/skills/calle/SKILL.md" source: "https://github.com/CALLE-AI/call-e-integrations/tree/main/skills/calle" verified-on: "2026-10-28" @@ -149,7 +149,7 @@ retain only task facts and recovery context there. 2. **Follow the selected workflow.** The [MCP call workflow](references/mcp.md#prepare-and-confirm) uses only `prepare_call`, `start_call`, `open_call`, `get_call`, and `get_call_transcript` as actually exposed by the host. It supports one immediate call at a time, with or without cards. API uses the bundled Calls v2 and read-only Goals v1 documentation. Neither path supports batch dialing or scheduled tasks here; API also excludes top-ups and Goal editing/publication. Keep each interface's parameters separate. 3. **Execute within the user's request.** For an authorized MCP call, once preparation is `ready`, invoke the exposed `start_call` with its returned ID and latest revision without asking for another confirmation. Honor a request to prepare only, wait, or use the card's Dial; readiness alone does not authorize dialing. Follow the host's tool approval requirements. The real card remains an optional way to review, edit or Dial the same preparation, including the compatible card-Dial route when `start_call` is confirmed missing. For API, proceed only within explicit execution authorization, reviewing an existing Goal or template before selecting it. 4. **Retain recovery context.** For MCP, retain the original request, server, returned `preparation_id`, current `revision`, execution authorization, and eventual `call.id` in the conversation or available host storage. A separate local journal is not required. Card Dial and `start_call` share the preparation's idempotency guarantee; recover the original preparation or Call rather than creating a replacement. Before an API write, use private host storage to save the interface, environment, known identity, original request, authorization scope/time, and supported idempotency information; if that record cannot be saved, provide only a preview. Never save credentials. -5. **Query or recover the same call.** Keep the original interface and identity. Follow [Wait for call results](references/polling.md): automatically continue querying while `result_status` is `pending`, with progressively longer intervals and progress updates, until a final result state, its fallback ceiling, or a genuine interruption. Tool batches are not completion criteria; the user does not need to say "continue querying" between phases. MCP cancellation uses the existing card when available; no Agent-callable MCP cancellation tool is currently supported, so report that limitation in a host without usable cards. API follows its own cancellation contract. Distinguish execution state, result readiness, and business success. +5. **Follow the same call.** Keep the original interface and identity. For MCP, use the [card handoff rules](references/mcp.md#follow-an-existing-call) after submission or reopening. A confirmed self-updating card follows the Call. When the Agent follows an MCP or API Call, use [Wait for call results](references/polling.md) to continue while `result_status` is `pending`, honoring the applicable stop conditions. MCP cancellation uses the existing card when available. API follows its own cancellation contract. Distinguish execution state, result readiness, and business success. Read interface details only when needed: @@ -175,11 +175,12 @@ For connection checks, report configuration, OAuth, tool loading/discovery, read ### Shared final delivery -When an executed or followed call reaches a final `result_status`, return this -receipt for both MCP and API Key, including when a result card is visible. Keep -the section meanings and order below; render the receipt directly, without a -surrounding code fence. Explicit requests for a narrower answer retain their -scope. +When the Agent receives a final `result_status` for an executed or followed +call, return this receipt for both MCP and API Key. If a confirmed self-updating +MCP card is following the Call, the card delivers the routine result after the +[handoff](references/mcp.md#follow-an-existing-call). An explicit request for a +chat result uses the same Call and the requested scope. Keep the section +meanings and order below and render the receipt directly without a code fence. Use the user's explicitly requested reply language; otherwise use the language of their current conversation. Apply it throughout the receipt: section headings, @@ -269,7 +270,6 @@ order, speaker labels and timestamps when provided. Do not shorten, summarize, translate or reconstruct dialogue. If the transcript is unavailable, retrieval fails, or only partial text is returned, state that limitation in the transcript section and never claim it is complete. -A result card supplements this receipt; it does not replace the final chat reply. If monitoring stops while results remain pending or unknown, follow the [waiting policy's interruption or ceiling report](references/polling.md), diff --git a/skills/calle/references/mcp.md b/skills/calle/references/mcp.md index 62fca4b..2f2b093 100644 --- a/skills/calle/references/mcp.md +++ b/skills/calle/references/mcp.md @@ -96,8 +96,8 @@ selection rules apply. Missing UI alone is not missing MCP dialing capability. never click for them. Otherwise `start_call` works the same with or without UI. Card Dial and `start_call` share one idempotent submission per preparation; if the card has already submitted, recover and follow that existing Call. -6. After `start_call`, retain `call.id` and immediately follow the existing call - under the result-waiting policy. Acceptance or a queued state does not mean +6. After `start_call`, retain `call.id` and apply the [card handoff and result + rules](#follow-an-existing-call). Acceptance or a queued state does not mean the recipient answered. Do not create another preparation to resume a call. If a preparation explicitly expired before submission, report it and prepare @@ -162,7 +162,7 @@ IDs distinct, and never convert old plan IDs, confirmation tokens, or run IDs. If the needed Call resource ID is absent from the conversation or saved context, ask the user for that reference rather than inventing one. -Each read uses this shape, replacing the illustrative value with the real ID: +The base argument is `call_id`. Substitute the real ID in the example. ```json {"call_id": "call_example"} @@ -174,14 +174,32 @@ Each read uses this shape, replacing the illustrative value with the real ID: cards, explain that cancellation cannot be performed through the available MCP tools; do not claim success, call a private card endpoint, or switch the existing call to API or CLI. Stopping result monitoring does not cancel a call. -- Use `get_call` for status and results. Follow [Wait for call results](polling.md) - and automatically continue querying while `result_status` is `pending`, using - phased intervals and any server wait guidance, subject to its fallback ceiling. +- After submission or reopening, hand off routine monitoring when the host or + user confirms that an actual self-updating card for this Call rendered. Briefly + acknowledge the known state and let the card refresh and show the result. + End routine Agent monitoring at that handoff, including if confirmation + arrives during Agent monitoring. Treat `presentation=widget`, + UI capability declarations, and resource metadata as presentation hints. + An explicit request for a chat status or receipt uses the original Call and + the user's requested read scope. +- If the card is unavailable, fails to render, or its rendering is unconfirmed, + use `get_call` to follow the same Call. This includes `presentation=agent_polling`. + Follow [Wait for call results](polling.md), including its server-provided MCP + interval and fallback rules. Continue automatically while `result_status` is + `pending`. `available`, `unavailable`, and `not_applicable` end result polling, even when `result` or `error` is null. Execution can be `completed` while result processing remains `pending`. No-answer, busy, and declined are reported telephone outcomes, not automatic technical failures. Never redial automatically; a completed execution alone does not establish business success. +- On successive `get_call` reads, pass the latest `progress.cursor` returned for + this Call as `progress_cursor` when the discovered input schema accepts it. + Retain the cursor with the original Call for interrupted monitoring. When the + cursor or schema support is absent, send the base argument. For + requested live conversation updates, use `progress.updates` and replace + revisions with the same stable line ID. On reopening or a transcript source + change, use the full `progress.conversation` snapshot. Apply the [pending + result read limits](../SKILL.md#read-and-report-results). - Use structured results for the summary and collect the complete available transcript for the [final receipt](../SKILL.md#shared-final-delivery). Use `call.transcript` when complete; otherwise read `get_call_transcript` with the @@ -189,7 +207,7 @@ Each read uses this shape, replacing the illustrative value with the real ID: schema; do not invent pagination parameters. While pending, follow [Read and report results](../SKILL.md#read-and-report-results); status checks do not need a transcript. Missing text does not establish that no call occurred. -- Once `result_status` is final, follow the shared +- When the Agent receives a final `result_status`, follow the shared [read-only receipt phase](../SKILL.md#read-and-report-results). Read a missing transcript only for this same Call, then deliver the receipt and end monitoring. Reuse a complete inline transcript without an extra read. A failed or unavailable diff --git a/skills/calle/references/polling.md b/skills/calle/references/polling.md index 7ee2efb..76b9180 100644 --- a/skills/calle/references/polling.md +++ b/skills/calle/references/polling.md @@ -1,10 +1,10 @@ # Wait for call results -Use this policy after a call is accepted or when the user asks to follow an -existing call. Keep querying in the current task until the result is final or -the fallback ceiling or an actual interruption is reached; progress messages do -not end the task. A request explicitly limited to a current snapshot or one read -ends after that read instead. +Use this policy when the Agent follows an accepted or existing Call. For MCP +with a confirmed self-updating card, apply the [card handoff](mcp.md#follow-an-existing-call) +first. Keep querying until the result is final, monitoring is interrupted, or +the applicable fallback ceiling is reached. A request limited to a current +snapshot or one read ends after that read. ## Query the original call @@ -32,44 +32,40 @@ Read `result_status` rather than execution `status` to decide whether to wait: Report `call_outcome` separately. Missing or invalid required fields and unknown states require an insufficient-information report with the existing ID retained. -## Slow down while waiting +## Choose the next delay -Make the first status read of a fresh monitoring session immediately when no -saved server wait is in force. Resuming an interrupted session is not a fresh -first read: restore the saved count and failure streak before any request, then -wait for the next query's phase interval and any remaining server delay. For -example, after 13 reads and three consecutive transient failures, wait at least -5 seconds before the one remaining retry, query 14. A saved streak of four -failed reads has exhausted its retry allowance; report the interruption without -another request unless the user explicitly authorizes a new monitoring session. -For subsequent reads in the initial monitoring session, choose the delay from -the next query's number: +Make the first read immediately when no server delay applies. For an MCP +Call with a valid pending snapshot, use its `progress.poll_after_seconds` as +the interval before the next read, including when the snapshot came from +`start_call` or `open_call`. Read the field from structured output or the +tool's documented JSON text payload for the original Call. Accept a finite +number greater than zero. For API reads, or when MCP provides no valid interval +in the latest response, choose the phase interval by the next query number. | Next query number | Wait before querying | | --- | --- | | 2-10 | 2 seconds | | 11-20 | 5 seconds | | 21-30 | 10 seconds | -| 31-120 | 20 seconds | - -These are client defaults, not a service SLA or server limit. Automatically -continue across all phases and tool batches, up to 120 status-read requests per -monitoring session; the user does not need to say "continue querying" between -phases. Count every status-read request, including transient-error retries. -Keep the count and any server not-before time with the original reference, -using private host storage or conversation context. Resume the saved count and -phase after an interruption, honoring any remaining wait. If the earlier count -is unavailable, report that gap and start a new capped session at the 20-second -interval rather than inventing a count. A batch boundary or completed execution -does not restart the count or fast phase. - -Respect server polling instructions, `Retry-After` (seconds or HTTP date), and -rate limits. Wait at least the greater of the phase interval and the server's -required remaining delay. Keep longer waits interruptible in chunks of at most -30 seconds, without querying early. Use the same ID for all reads. - -Use the real card for progress when available. Otherwise, send a brief progress -message when the state changes and at least once every 60 seconds while waiting. +| 31 and later | 20 seconds | + +Continue across tool batches. Count every status read, including retries. With +the original reference, retain the count, whether MCP supplied a valid interval +in this session, the consecutive failure streak, and the next permitted read +time in private host storage or conversation context. After an interruption, +restore these before reading. If the next permitted read time is unavailable, +wait the selected interval before resuming. If the count is unavailable, report +the gap and use a new session with a 20-second fallback interval. With a saved +streak of four failures, report retry exhaustion unless the user explicitly +authorizes a new monitoring session. + +Respect `Retry-After` (seconds or HTTP date) and documented rate limits. Wait +at least the greater of the selected interval and any required server delay. +Split longer waits into interruptible chunks of at most 30 seconds. Use the +same ID for all reads. + +Send a brief progress message when the state changes and at least once every +60 seconds while following the Call in chat. Track when the last user-visible update was sent. Before each wait, include the planned delay and time already spent in requests: if the next update would be more than 60 seconds after the last one, send progress first. Split longer server @@ -89,25 +85,28 @@ or authorize another operation. ## Fallback ceiling -The 120-read ceiling prevents indefinite waiting for a service that keeps -returning `pending`. With the default intervals it allows about 33 minutes of -waiting, excluding request time and additional server delays. There is no -separate client elapsed-time cutoff. If read 120 is final, report that result -normally. If it remains `pending`, retain the original reference, latest valid -state, count, and server not-before time, and report that the fallback ceiling -was reached with the result still pending. This does not establish call failure +Apply the 120-read ceiling to API monitoring and to MCP monitoring that has +received no valid server interval in the session. Once MCP supplies a valid +interval, continue to a final result or an interruption even after read 120. +Use the phased fallback for individual responses that omit a valid interval. + +For sessions subject to the ceiling, the phased defaults allow about 33 minutes +of waiting, excluding request time and additional server delays. Report a final +result on read 120 normally. If it remains `pending`, retain the original +reference, latest valid state, count, and server not-before time. Report that +the fallback ceiling was reached with the result still pending. This does not establish call failure or authorize canceling or redialing. End this monitoring session without issuing read 121 or claiming background monitoring. A later explicit user request to -continue may open another 120-read session for the same call. This new session -keeps the 20-second interval, including before its first read, and any server -not-before time; it does not repeat the initial session's faster phases. +continue may open another 120-read session for the same call. In the new session, +keep any server not-before time and use 20 seconds as the fallback interval, +including before its first read when no MCP interval is available. ## Errors and interruptions A transient read failure does not establish that the call failed. For a timeout, transport failure, HTTP 429, or HTTP 503, allow the initial failed read plus up to -three consecutive retry reads, within the 120-read ceiling and honoring the -phase delay and server wait guidance. Reset the failure streak after a valid +three consecutive retry reads, within any applicable read ceiling and honoring +the selected delay and server wait guidance. Reset the failure streak after a valid response, without resetting the polling phase. Preserve this failure streak across tool batches and interruptions; only a valid response or an explicitly authorized new monitoring session resets the retry allowance. If those retries diff --git a/skills/calle/references/testing-mcp.md b/skills/calle/references/testing-mcp.md index bda5c08..a1dc1c1 100644 --- a/skills/calle/references/testing-mcp.md +++ b/skills/calle/references/testing-mcp.md @@ -90,9 +90,16 @@ presented, report that limitation instead of overriding the wait instruction. Acceptance: use the actual `call.id` as the read tools' `call_id` argument, not the nested Billing `call.call_id`, a preparation ID, or a legacy run ID. Use `open_call` for its card, `get_call` for state/results, and `get_call_transcript` -for available conversation text. Follow [Wait for call results](polling.md) and -continue automatically while `result_status` is `pending`, across polling phases -up to the fallback ceiling without requiring another user message. +for available conversation text. With a confirmed self-updating card for the +Call, verify that a brief acknowledgment ends routine Agent monitoring and the +card presents the result. Test an absent or failed card and `presentation=widget` +without mount confirmation. In each case the Agent follows the same Call using +[Wait for call results](polling.md). Test a valid `progress.poll_after_seconds` +shorter than the current fallback phase, a longer required server wait, and a +missing or invalid hint. Verify a server-paced Call continues past 120 reads and +that a session with no valid server interval stops at the fallback ceiling. For +successive reads, verify that the Agent sends the Call's returned cursor only +when the discovered schema accepts `progress_cursor`. `unavailable` and `not_applicable` are final even with null result/error. Do not infer business success from completed execution, or invent a missing transcript. Report missing query capability or IDs without recreating the call or promising @@ -101,8 +108,9 @@ after ten or thirty reads, final or pending results on read 120, server wait guidance, interruptions, and explicit snapshot-only requests without placing additional calls. -Verify the [final receipt](../SKILL.md#shared-final-delivery) in chat in hosts -with and without cards: status, summary, confirmed callee number, duration, time, +Verify the [final receipt](../SKILL.md#shared-final-delivery) in chat when the +Agent follows the call or the user explicitly requests it with a card present. +Check that status, summary, confirmed callee number, duration, time, telephone `call.call_id` and all available transcript turns appear in the fixed order. With distinct `call.id` and `call.call_id`, verify that tool arguments still use `call.id` and the receipt displays `call.call_id`. A null or missing diff --git a/tests/README.md b/tests/README.md index 4e09aac..7c29da4 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,6 +1,6 @@ # calle Offline Development Tests -Current canonical identity is `calle` with metadata/evaluation version `1.0.6`. +Current canonical identity is `calle` with metadata/evaluation version `1.0.7`. Scenario IDs remain stable across the rename. Earlier `callev2` and `calle-connect` records retain their original names, versions and hashes; they do not establish acceptance of this canonical artifact. The initial @@ -172,7 +172,9 @@ response ranges cover results after twelve and thirty-two reads, completed execution with a pending result, all four delay phases, server minimum waits, interruptible waits and progress, terminal/unavailable results, user stops, snapshot-only requests, host interruptions, and retry exhaustion or reset. -Boundary variants cover final and pending results on request 120, retry requests +An MCP variant supplies a server interval and cursor on read 120, advertises a +widget without a verified card mount, and continues past the fallback ceiling. +API and MCP fallback variants cover final and pending results on request 120, retry requests consuming the last slot, known and unknown saved counts, and later explicit continuation retaining the 20-second phase. Counts, failure streaks and server deadlines survive known batches and interruptions. Only an explicitly listed diff --git a/tests/agent-evaluation.md b/tests/agent-evaluation.md index 3d4f08f..3bb972f 100644 --- a/tests/agent-evaluation.md +++ b/tests/agent-evaluation.md @@ -1,6 +1,6 @@ # Offline Agent Evaluation Adapters and Grading -Current canonical identity is `calle` with metadata/evaluation version `1.0.6`. +Current canonical identity is `calle` with metadata/evaluation version `1.0.7`. Scenario IDs remain stable across the rename. Earlier `callev2` and `calle-connect` records retain their original names, versions and hashes; they do not establish acceptance of this canonical artifact. The initial @@ -173,8 +173,7 @@ identifiers so argument traces can establish which identifier was used. `api-polling-01` and `mcp-polling-01` monitor an already-created synthetic Call under the shared [waiting policy](../skills/calle/references/polling.md). -Each group has 22 independent variants; execution status comes from its actual -run and review records. The base responses +Execution status comes from actual run and review records. The base responses cover 31 completed/pending reads followed by an available empty object on read 32, with tool batches ending at 10, 20 and 30. Ranges in `fixture_status_reads` repeat only the supplied response for those cumulative query ordinals; they do @@ -188,12 +187,22 @@ preparation helpers only build the catalog; [stateful_mocks.py](behavior/statefu and [fixture_server.py](behavior/fixture_server.py) implement synthetic state and dispatch separately. +The base MCP fixtures omit `progress.poll_after_seconds` and exercise the phased +fallback. `server-interval-with-unconfirmed-widget` exposes the hint in the +tool's JSON text payload and supplies no verified card mount. On the next read, +the two-second server interval takes precedence over the 20-second fallback and +allows read 121. The Agent passes the same Call's cursor where the tool schema +accepts it. The next response omits the interval, so read 122 uses the phased +fallback and returns the terminal result. Verify a self-updating card handoff using the +[MCP manual checks](../skills/calle/references/testing-mcp.md#d-query-and-recovery). + Capture cumulative query count, session request count, consecutive transient failures, original ID, latest valid response and server not-before before and after every query, wait, batch boundary and interruption. Count initial and -retry reads against the 120-request session ceiling. Query 120 can return a -normal terminal result; if it remains pending, no query 121 occurs in that -session. A later explicitly authorized new session retains the 20-second phase +retry reads against the 120-request ceiling for API sessions and MCP sessions +with no valid interval. In those sessions, query 120 can return a normal terminal +result, and a pending response ends the session. A later explicitly authorized +new session retains the 20-second phase and server deadline. A missing saved count is reported and starts a new capped session at 20 seconds, without inventing cumulative query 31; these fixtures use `session_request_ordinal_range` and null cumulative ordinals for that case. diff --git a/tests/behavior/calle-evals.json b/tests/behavior/calle-evals.json index b1daa37..10697a8 100644 --- a/tests/behavior/calle-evals.json +++ b/tests/behavior/calle-evals.json @@ -1,6 +1,6 @@ { "skill": "calle", - "version": "1.0.6", + "version": "1.0.7", "evaluation_status": "not_executed_on_an_agent", "notice": "Synthetic offline Agent behavior fixtures only. Original API/MCP IDs are retained with explicitly selected interfaces; routing and updates use separate mock scopes. No Agent execution, real credentials or live service results are represented.", "cases": [ @@ -5193,7 +5193,7 @@ { "id": "api-polling-01", "skill": "calle", - "version": "1.0.6", + "version": "1.0.7", "selected_transport": "api", "mock_action_scope": "api_call", "execution_status": "NOT_RUN", @@ -6670,7 +6670,7 @@ { "id": "mcp-polling-01", "skill": "calle", - "version": "1.0.6", + "version": "1.0.7", "selected_transport": "mcp", "mock_action_scope": "mcp_call", "execution_status": "NOT_RUN", @@ -6806,7 +6806,7 @@ "Respect server Retry-After or rate-limit guidance as a minimum, taking the greater of the phase delay and remaining server delay; split waits into interruptible chunks of at most 30 seconds and provide progress within 60 seconds.", "Preserve cumulative phase, current-session request count, consecutive transient-failure streak, latest state, original resource ID, and server not-before value across known tool batches and interrupted resumption. Only a valid read or an explicitly authorized new monitoring session resets the failure streak.", "Stop normally on available, unavailable, or not_applicable; available requires an actual object and the empty object is valid. Do not infer connection or business success from readiness alone.", - "Count the first read and all retry requests toward a maximum of 120 requests in the same monitoring session. At pending query 120 preserve state and report fallback exhaustion, with no query 121, redial, cancellation, false terminal state, or background-monitoring claim.", + "For a monitoring session with no valid server interval, count the first read and all retries toward the 120-read fallback ceiling. A valid MCP interval permits continued same-Call reads beyond that ceiling. At a fallback stop, preserve state and report the pending result.", "Stop on explicit user stop or cancellation, a genuine host hard interruption, invalid response/schema, authentication failure, fatal error, or exhausted transient retries. An explicitly snapshot-only request performs one read and schedules no monitoring." ], "fixture_tools": [ @@ -6964,6 +6964,138 @@ "cumulative": 12 } }, + { + "id": "server-interval-with-unconfirmed-widget", + "prompt": "Keep following my existing MCP call call_fixture_polling_mcp. I cannot see a call card in this chat.", + "fixture_status_reads": [ + { + "query_ordinal_range": [ + 120, + 120 + ], + "response": { + "isError": false, + "content": [ + { + "type": "text", + "text": "{\"call\": {\"id\": \"call_fixture_polling_mcp\", \"status\": \"completed\", \"result_status\": \"pending\"}, \"presentation\": \"widget\", \"progress\": {\"poll_after_seconds\": 2, \"cursor\": \"call_fixture_polling_mcp:120\"}}" + } + ], + "structuredContent": { + "call": { + "id": "call_fixture_polling_mcp", + "status": "completed", + "result_status": "pending", + "result": null, + "error": null + } + } + } + }, + { + "query_ordinal_range": [ + 121, + 121 + ], + "response": { + "isError": false, + "content": [ + { + "type": "text", + "text": "{\"call\": {\"id\": \"call_fixture_polling_mcp\", \"status\": \"completed\", \"result_status\": \"pending\"}, \"presentation\": \"widget\", \"progress\": {\"cursor\": \"call_fixture_polling_mcp:121\"}}" + } + ], + "structuredContent": { + "call": { + "id": "call_fixture_polling_mcp", + "status": "completed", + "result_status": "pending", + "result": null, + "error": null + } + } + } + }, + { + "query_ordinal_range": [ + 122, + 122 + ], + "response": { + "isError": false, + "structuredContent": { + "call": { + "id": "call_fixture_polling_mcp", + "status": "completed", + "result_status": "available", + "result": {}, + "error": null + } + } + } + } + ], + "expected": [ + "Read the original Call after the 20-second fallback preceding query 120. The widget is unconfirmed. Observe the valid two-second interval and continue this session past read 120.", + "Pass the previous same-Call progress.cursor as progress_cursor for queries 121 and 122 because the discovered get_call schema supports it. Wait two seconds before query 121 and use the 20-second fallback before query 122 after the hint is absent. Report the available result on query 122." + ], + "setup": { + "polling_state": { + "cumulative_query_count": 119, + "session_query_count": 119, + "server_not_before_virtual_seconds": null, + "consecutive_transient_failures": 0 + } + }, + "fixture_wait_plan": [ + { + "query_ordinals": [ + 120, + 120 + ], + "seconds": 20 + }, + { + "query_ordinals": [ + 121, + 121 + ], + "seconds": 2 + }, + { + "query_ordinals": [ + 122, + 122 + ], + "seconds": 20 + } + ], + "expected_read_counts": { + "session": 122, + "cumulative": 122 + }, + "fixture_tools": [ + { + "name": "mcp__calle_connect__get_call", + "description": "Synthetic current Call read with optional progress_cursor for the same Call.", + "inputSchema": { + "type": "object", + "properties": { + "call_id": { + "type": "string" + }, + "progress_cursor": { + "type": "string" + } + }, + "required": [ + "call_id" + ], + "additionalProperties": false + } + } + ] + }, { "id": "resume-after-30-reads", "fixture_status_reads": [ diff --git a/tests/behavior/stateful_mocks.py b/tests/behavior/stateful_mocks.py index 89f8acf..f9b896f 100644 --- a/tests/behavior/stateful_mocks.py +++ b/tests/behavior/stateful_mocks.py @@ -352,11 +352,17 @@ def from_state(cls, source_case: dict, state: dict) -> "StatefulMock": raise ValueError("Controller interruption history repeats an event") if restored.polling: polling = current["state"] - if not isinstance(polling, dict) or set(polling) != set(restored.state): + if not isinstance(polling, dict): raise ValueError("Controller polling fields are invalid") - for key, maximum in (("session_query_count", 120), ("consecutive_transient_failures", 4)): - if type(polling[key]) is not int or not 0 <= polling[key] <= maximum: - raise ValueError("Controller polling counters are invalid") + server_paced = restored.transport == "mcp" and polling.get("mcp_server_interval_seen") is True + fields = set(restored.state) | ({"mcp_server_interval_seen"} if server_paced else set()) + if set(polling) != fields: + raise ValueError("Controller polling fields are invalid") + session_count = polling["session_query_count"] + failure_count = polling["consecutive_transient_failures"] + if (type(session_count) is not int or session_count < 0 or (not server_paced and session_count > 120) + or type(failure_count) is not int or not 0 <= failure_count <= 4): + raise ValueError("Controller polling counters are invalid") count = polling["cumulative_query_count"] if count is not None and (type(count) is not int or count < polling["session_query_count"]): raise ValueError("Controller cumulative count is invalid") @@ -417,7 +423,30 @@ def _dispatch(self, action, args): return self._onboarding_http(action, args) raise NotImplementedError("No complete stateful fixture implements this action") + def _mcp_service_interval(self): + if self.transport != "mcp" or not self.latest_response: + return None + for block in self.latest_response.get("content", []): + if block.get("type") != "text": + continue + try: + payload = json.loads(block["text"]) + except json.JSONDecodeError: + continue + call = payload.get("call") if isinstance(payload, dict) else None + if not isinstance(call, dict) or call.get("id") != self.call_id: + continue + progress = payload.get("progress") + hint = progress.get("poll_after_seconds") if isinstance(progress, dict) else None + if type(hint) in (int, float) and math.isfinite(hint) and hint > 0: + return hint + return None + def _next_delay(self): + if not self.state["consecutive_transient_failures"]: + interval = self._mcp_service_interval() + if interval is not None: + return interval count = self.state["cumulative_query_count"] if count is None: return 20 @@ -458,7 +487,8 @@ def _interrupt(self): "polling_state": copy.deepcopy(self.state)}) def _poll(self, args): - if self.stopped_reason or self.state["session_query_count"] >= 120: + if self.stopped_reason or (self.state["session_query_count"] >= 120 + and not self.state.get("mcp_server_interval_seen")): raise PermissionError("Monitoring has stopped or exhausted its session cap") if self.transport == "api": if args.get("url") != API_ORIGIN + "/v2/calls/" + self.call_id: @@ -505,6 +535,8 @@ def _poll(self, args): self.latest_response = copy.deepcopy(result) if body["result_status"] in _TERMINAL: self.stopped_reason = "terminal_result" + elif self._mcp_service_interval() is not None: + self.state["mcp_server_interval_seen"] = True else: raise NotImplementedError("Polling response has no observation") delay = self.case.get("fixture_retry_after", {}) @@ -517,7 +549,7 @@ def _poll(self, args): result["synthetic_server_wait"] = {"minimum_seconds": delay["minimum_seconds"], "not_before_virtual_seconds": deadline} if self.variant_id == "snapshot-only": self.stopped_reason = "snapshot_complete" - if session == 120 and self.stopped_reason is None: + if session == 120 and self.stopped_reason is None and not self.state.get("mcp_server_interval_seen"): self.stopped_reason = "session_cap" self._interrupt() if self.host_event: diff --git a/tests/test_behavior_preparation.py b/tests/test_behavior_preparation.py index 1ab6110..d46cb97 100644 --- a/tests/test_behavior_preparation.py +++ b/tests/test_behavior_preparation.py @@ -168,7 +168,7 @@ def test_polling_groups_preserve_read_only_actions_and_phased_long_results(self) fixture = case["fixture"] source = fixture["source_case"] self.assertEqual(source["execution_status"], "NOT_RUN") - self.assertEqual(source["version"], "1.0.6") + self.assertEqual(source["version"], "1.0.7") self.assertEqual(set(fixture["allowed_actions"]), {"local.report", "journal.read", "journal.write", "host.mock_wait", "http.GET" if transport == "api" else "mcp.get_call"}) @@ -203,7 +203,7 @@ def test_polling_groups_preserve_read_only_actions_and_phased_long_results(self) self.assertEqual(variants["snapshot-only"]["expected_read_counts"]["session"], 1) self.assertEqual(variants["snapshot-only"]["fixture_wait_plan"], [{"query_ordinals": [1, 1], "seconds": 0}]) - self.assertEqual(len(source["variants"]), 23 if transport == "mcp" else 22) + self.assertEqual(len(source["variants"]), 24 if transport == "mcp" else 22) resumed = variants["host-hard-interruption-resume"] self.assertEqual(len(resumed["turns"]), 2) self.assertEqual(resumed["expected_read_counts"], {"session": 11, "cumulative": 11}) diff --git a/tests/test_skill_integrity.py b/tests/test_skill_integrity.py index f443626..24a076b 100644 --- a/tests/test_skill_integrity.py +++ b/tests/test_skill_integrity.py @@ -33,7 +33,7 @@ def test_canonical_identity_has_consistent_install_and_ui_metadata(self): metadata = yaml.safe_load((skill / "SKILL.md").read_text().split("---", 2)[1]) interface = yaml.safe_load((skill / "agents/openai.yaml").read_text())["interface"] self.assertEqual(metadata["name"], skill.name) - self.assertEqual(metadata["metadata"]["version"], "1.0.6") + self.assertEqual(metadata["metadata"]["version"], "1.0.7") self.assertEqual(interface["display_name"], metadata["name"]) self.assertIn("$calle", interface["default_prompt"]) self.assertGreaterEqual(len(interface["short_description"]), 25) diff --git a/tests/test_stateful_mocks.py b/tests/test_stateful_mocks.py index aa80ec0..f3711df 100644 --- a/tests/test_stateful_mocks.py +++ b/tests/test_stateful_mocks.py @@ -94,11 +94,31 @@ def test_all_polling_variants_are_pure_and_preserve_expected_counts(self): self.assertIsNotNone(mock.stopped_reason) self.assertEqual(mock.create_count, 0) executed += 1 - self.assertEqual(executed, 45) + self.assertEqual(executed, 46) # Dedicated actual-checkpoint resume tests live in test_polling_interruption_resume.py. self.assertEqual(multiturn, [(case_id, "host-hard-interruption-resume") for case_id in ("api-polling-01", "mcp-polling-01")]) + def test_mcp_service_interval_crosses_fallback_cap_and_keeps_cursor_after_resume(self): + case = self.cases["mcp-polling-01"] + mock = StatefulMock(case, variant(case, "server-interval-with-unconfirmed-widget")) + wait(mock, 20) + pending = read(mock) + cursor = json.loads(pending["content"][0]["text"])["progress"]["cursor"] + mock = StatefulMock.from_state(case, mock.export_state()) + args = {"call_id": mock.call_id, "progress_cursor": cursor} + with self.assertRaises(PermissionError): + mock.dispatch("mcp.get_call", args) + wait(mock, 2) + pending = mock.dispatch("mcp.get_call", args) + progress = json.loads(pending["content"][0]["text"])["progress"] + self.assertNotIn("poll_after_seconds", progress) + mock = StatefulMock.from_state(case, mock.export_state()) + wait(mock, 20) + final = mock.dispatch("mcp.get_call", {**args, "progress_cursor": progress["cursor"]}) + self.assertEqual(final["structuredContent"]["call"]["result_status"], "available") + self.assertEqual(mock.state["session_query_count"], 122) + def test_resumed_counts_determine_phase_and_early_reads_do_not_consume_responses(self): case = self.cases["api-polling-01"] mock = StatefulMock(case, variant(case, "resume-after-10-reads"))