Skip to content

fix: forward missing run kwargs in Actor.start/call/call_task#906

Merged
vdusek merged 2 commits into
masterfrom
fix/actor-call-missing-kwargs
May 25, 2026
Merged

fix: forward missing run kwargs in Actor.start/call/call_task#906
vdusek merged 2 commits into
masterfrom
fix/actor-call-missing-kwargs

Conversation

@vdusek
Copy link
Copy Markdown
Contributor

@vdusek vdusek commented May 20, 2026

Summary

ActorClient.call (apify-client) exposes several run-configuration kwargs that the SDK wrapper Actor.call was silently dropping, forcing users to bypass the SDK and reach into Actor.apify_client.actor(id).call(...) (e.g. to set max_total_charge_usd for pay-per-event Actors — see the user report).

This patch wires through the missing parameters so the SDK API matches the underlying client:

  • Actor.start / Actor.call — adds max_items, max_total_charge_usd, restart_on_error, force_permission_level
  • Actor.call_task — adds max_items, restart_on_error (the task endpoint has no max_total_charge_usd / force_permission_level)

Docstrings updated to match. No change to existing kwargs or call semantics; pyproject apify-client constraint unchanged.

Align the SDK wrappers with `apify-client`: pass through `max_items`,
`max_total_charge_usd`, `restart_on_error`, and `force_permission_level`
so users no longer have to drop down to the raw client to set them.
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels May 20, 2026
@vdusek vdusek self-assigned this May 20, 2026
@github-actions github-actions Bot added this to the 141st sprint - Tooling team milestone May 20, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.01%. Comparing base (f394c75) to head (441d479).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #906   +/-   ##
=======================================
  Coverage   87.01%   87.01%           
=======================================
  Files          48       48           
  Lines        2942     2942           
=======================================
  Hits         2560     2560           
  Misses        382      382           
Flag Coverage Δ
e2e ?
integration 59.04% <ø> (ø)
unit 75.76% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek requested review from MatousMarik and janbuchar May 20, 2026 15:07
Copy link
Copy Markdown

@MatousMarik MatousMarik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok to me.

One concern though: this approach of manually mirroring kwargs from the
client is fragile — next time the client adds a parameter, someone has to
remember to update the SDK too. Would it be possible to extract the
"passthrough" subset into a shared TypedDict and use **kwargs:
Unpack[RunConfig]? That would make the boundary explicit and future-safe.

Also, was a full audit done against the current client signatures? This PR
fixes the reported case, but are we confident there are no other missing
args across start / call / call_task right now?

Comment thread src/apify/_actor.py Outdated
@vdusek
Copy link
Copy Markdown
Contributor Author

vdusek commented May 25, 2026

One concern though: this approach of manually mirroring kwargs from the client is fragile — next time the client adds a parameter, someone has to remember to update the SDK too. Would it be possible to extract the
"passthrough" subset into a shared TypedDict and use **kwargs: Unpack[RunConfig]? That would make the boundary explicit and future-safe.

It's fragile, but that's the trade-off if we want to propagate methods and arguments downstream. This is the approach that was established here before I joined, so we're just continuing consistently. The typed-dict alternative has its own drawbacks, too. If we want to rethink this, I would challenge the "propagate methods and arguments downstream" approach itself.

Also, was a full audit done against the current client signatures? This PR fixes the reported case, but are we confident there are no other missing args across start / call / call_task right now?

Everything should be addressed now (if I didn't overlook anything).

@vdusek vdusek merged commit 7a13809 into master May 25, 2026
28 of 30 checks passed
@vdusek vdusek deleted the fix/actor-call-missing-kwargs branch May 25, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants