Skip to content

fix: State facts instead of asking for a retry in served hints - #1578

Merged
jirispilka merged 2 commits into
masterfrom
fix/served-retry-wording
Oct 15, 2026
Merged

jirispilka merged 2 commits into
masterfrom
fix/served-retry-wording

Conversation

@jirispilka

@jirispilka jirispilka commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Closes #1558.

TOOL_GUIDELINES.md says served text states what happened or what a parameter does; it does not ask the model to call again. The generic HTTP hints in src/utils/mcp.ts are returned by every tool and by resources/read, so they reach every tool set, the Claude connector's included.

What changed

Tool text contract change. No eval references these strings.

Where Before Now
HTTP 429 hint Rate limit exceeded, wait before retrying. The Apify API rate limit was reached.
HTTP 5xx hint The server failed to process the request, likely a temporary issue. Retry later. The Apify API failed to process the request; this is usually temporary.
Task publish error Fix the stated requirement before retrying. The error message names the requirement that is not met.
delete-actor, unfinished runs Ask the user whether to abort them, and if so call again with abortRunningRuns set to true; otherwise wait until they finish. Ask the user whether to abort them. abortRunningRuns=true aborts them before deleting; otherwise the Actor can be deleted once they finish.
call-actor memory quota error Retry with a smaller callOptions.memory, or wait for current runs to finish before retrying. A smaller callOptions.memory may fit the remaining quota; memory is freed when current runs finish.
callOptions.memory description …if a run is rejected because that quota would be exceeded, retry with a smaller value. …a run that would exceed that quota is rejected.

The memory error still does not mention aborting runs. Out of scope as agreed in the issue: the build-wait hint in get_actor_build.ts, run results (#1559), pagination hints.

Not in the issue's list and left as is: src/errors.ts:71 (Failed to load Actor "X". Please try again later., served by call-actor) and src/tools/builds/build_helpers.ts:137,142 (build tools).

Notes for reviewers (human-written)

Proof it works

Unit tests pin each new string exactly; they failed on master before the change (13 failures across 6 files).

mcpc against a local stdio build (0.18.3 + this branch), invalid token, --tools runs,storage, tools-call get-dataset-list '{}' (goes through getToolCallErrorUserText → getHttpErrorHint):

Error calling tool "get-dataset-list": User was not found or authentication token is not valid (API error type: user-or-token-not-found). Authentication failed, check APIFY_TOKEN is set and valid.

tools-get call-actor, callOptions.memory description:

Memory per run in MB. Power of 2 from 128 to 32768.
Apify also caps total memory across all your concurrent runs (account plan limit); a run that would exceed that quota is rejected.

429 and 5xx cannot be triggered on demand; unit tests cover them.

AI-assisted: Claude Code wrote the change, tests and this description, and ran the mcpc probe.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CPzYK17FoL2F3cuVonqnej


Generated by Claude Code

The 429 and 5xx hints every tool returns, the task publish error, the
delete-actor unfinished-runs error, and call-actor's memory quota error
and callOptions.memory description now say what happened or what an
option does instead of asking for another call.

Closes #1558

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPzYK17FoL2F3cuVonqnej
@jirispilka
jirispilka marked this pull request as ready for review October 14, 2026 10:54
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 14, 2026
@apify-service-account apify-service-account added the t-ai Issues owned by the AI team. label Oct 14, 2026
@jirispilka
jirispilka merged commit 62f30e6 into master Oct 15, 2026
28 of 29 checks passed
@jirispilka
jirispilka deleted the fix/served-retry-wording branch October 15, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Served text asks the model to retry instead of stating what a parameter does

4 participants