Skip to content

fix(rap): treat servers that don't support /tool_call_status as having given up on the call#62

Draft
shadaj wants to merge 1 commit into
mainfrom
sandbox-c20ca70d-6e6b-46bc-a469-116a46741b89
Draft

fix(rap): treat servers that don't support /tool_call_status as having given up on the call#62
shadaj wants to merge 1 commit into
mainfrom
sandbox-c20ca70d-6e6b-46bc-a469-116a46741b89

Conversation

@shadaj

@shadaj shadaj commented Jul 8, 2026

Copy link
Copy Markdown
Member

Previously, a server responding 404 (or any non-2xx) to a /tool_call_status query was treated as unknown liveness and its pending tool calls / subscriptions were kept pending forever. Since such a server cannot be tracking the call in a way that survives restarts, the default is now to treat the call/subscription as failed and prune it.

New liveness semantics (rap-client)

  • check_tool_call_status now maps:
    • 2xx + valid body → Alive / Gone as reported (unchanged)
    • 4xx (endpoint unsupported, e.g. 404 from an older server) → Gone (was Unknown)
    • 2xx with unparseable body → Gone (was Unknown)
    • 5xx (transient server error) → Unknown (kept pending)
    • transport error (unreachable) → Unknown (kept pending)
  • ToolCallLiveness docs updated to reflect the new contract.

The daemon's reconcile logic is unchanged (prunes on Gone, keeps on Alive/Unknown) — the new mapping means unsupported-endpoint servers now get their orphaned work pruned on boot, while genuinely unreachable servers still get the benefit of the doubt.

Tests

  • Flipped keeps_pending_tool_call_when_endpoint_unsupportedprunes_pending_tool_call_when_endpoint_unsupported (404 now injects the failure result).
  • New prunes_dead_subscription_when_endpoint_unsupported (404 → final subscription-failure event).
  • New keeps_pending_tool_call_on_transient_server_error (500 → kept pending).

Docs

  • tool-call-status.md: rewrote Runtime Error Semantics into the two categories (endpoint unsupported → prune; server unavailable → unknown, never prune), with the rationale that a hung conversation is worse than a spurious failure; updated the recovery and dispatch sections (multi-server broadcast querying must not treat a non-owning server's alive: false/404 as authoritative when the owning server is unreachable).
  • Updated lifecycle.md, building-a-rap-tool.md (endpoint is now effectively required for async/subscription tools), building-a-runtime.md, subscription-events.md, and infinity-code/background-agents.md to match.

…ing given up on the call

Previously, a server responding 404 (or any non-2xx) to a `/tool_call_status` query was treated as *unknown* liveness and its pending tool calls / subscriptions were kept pending forever. Since such a server cannot be tracking the call in a way that survives restarts, the default is now to treat the call/subscription as failed and prune it.

## New liveness semantics (`rap-client`)

* `check_tool_call_status` now maps:
  * 2xx + valid body → `Alive` / `Gone` as reported (unchanged)
  * **4xx (endpoint unsupported, e.g. 404 from an older server) → `Gone`** (was `Unknown`)
  * **2xx with unparseable body → `Gone`** (was `Unknown`)
  * 5xx (transient server error) → `Unknown` (kept pending)
  * transport error (unreachable) → `Unknown` (kept pending)
* `ToolCallLiveness` docs updated to reflect the new contract.

The daemon's reconcile logic is unchanged (prunes on `Gone`, keeps on `Alive`/`Unknown`) — the new mapping means unsupported-endpoint servers now get their orphaned work pruned on boot, while genuinely unreachable servers still get the benefit of the doubt.

## Tests

* Flipped `keeps_pending_tool_call_when_endpoint_unsupported` → `prunes_pending_tool_call_when_endpoint_unsupported` (404 now injects the failure result).
* New `prunes_dead_subscription_when_endpoint_unsupported` (404 → final subscription-failure event).
* New `keeps_pending_tool_call_on_transient_server_error` (500 → kept pending).

## Docs

* `tool-call-status.md`: rewrote **Runtime Error Semantics** into the two categories (endpoint unsupported → prune; server unavailable → unknown, never prune), with the rationale that a hung conversation is worse than a spurious failure; updated the recovery and dispatch sections (multi-server broadcast querying must not treat a non-owning server's `alive: false`/404 as authoritative when the owning server is unreachable).
* Updated `lifecycle.md`, `building-a-rap-tool.md` (endpoint is now effectively required for async/subscription tools), `building-a-runtime.md`, `subscription-events.md`, and `infinity-code/background-agents.md` to match.

Co-authored-by: Infinity 🤖 <infinity@hydro.run>
PR: #62
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploying infinity with  Cloudflare Pages  Cloudflare Pages

Latest commit: bb01dcc
Status: ✅  Deploy successful!
Preview URL: https://2b5a32e6.infinity-dc7.pages.dev
Branch Preview URL: https://sandbox-c20ca70d-6e6b-46bc-a.infinity-dc7.pages.dev

View logs

@shadaj
shadaj force-pushed the sandbox-c20ca70d-6e6b-46bc-a469-116a46741b89 branch from deb8392 to bb01dcc Compare July 9, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant