fix(apify): correct token URL, poll run --wait, add live --max-cost watchdog, reachable abort#1412
fix(apify): correct token URL, poll run --wait, add live --max-cost watchdog, reachable abort#1412michegz wants to merge 3 commits into
Conversation
…atchdog, reachable abort Four fixes from dogfooding apify-pp-cli against apify/facebook-marketplace-scraper: - F1: auth setup/doctor pointed to an MDN page; now https://console.apify.com/settings/integrations - F2: run --wait sent waitForFinish=60 past the 30s client timeout; now polls under a bounded server block - F3: live --max-cost watchdog aborts a --wait run once reported cost exceeds the cap (protects first runs with no history) - F4: actor-runs abort <runId> now works directly instead of only printing parent help
Greptile SummaryThis PR fixes four bugs surfaced by dogfooding the
Confidence Score: 5/5Safe to merge; all four fixes are targeted and well-reasoned, with no regressions introduced in the shared poll loop. The four bug fixes are narrow and correct: the URL replacements are mechanical, the waitForFinish cap removes a real client-timeout failure, the cost watchdog checks terminal status before cost (avoiding spurious aborts), and the abort shorthand leverages pflag pointer-binding to forward --gracefully correctly. The only open items are two style-level observations — aborted runs not being recorded in local history, and waitSecs not capped at 60 for unusually large HTTP client timeouts — neither of which affects correctness for the common default-30s-timeout case. run.go warrants the most attention: the waitSecs formula and the cost-watchdog abort path. actor-runs_abort.go is also worth a second read to confirm the pflag pointer behaviour matches expectations. Important Files Changed
|
Addresses Greptile review on mvanhorn#1412: the live --max-cost watchdog evaluated cost before terminal status, so a run that finished naturally with final cost just over the cap got a spurious abort + false 'aborted to stop billing' error. Terminal status is now checked first; the watchdog only fires on a still-running Actor.
|
Thanks @greptile-apps — good catch on the watchdog ordering. Fixed in 1e2b0a6: On the secondary note (F4 |
|
The ordering fix in 1e2b0a6 looks correct — terminal check first eliminates the race where a naturally-completed run with a final cost tick over the cap would hit a 404/no-op abort and potentially surface a confusing error to the user. On |
Addresses Greptile P2 on mvanhorn#1412: the abort <runId> shorthand delegated to the child RunE without the child's --gracefully flag, so 'abort --gracefully <id>' failed with 'unknown flag'. The parent now registers --gracefully and forwards it to the child's bound flag, making the shorthand equivalent to the leaf form.
|
Ready for maintainer review whenever you have a moment 🙏 Quick status: CI is green, Scope is four dogfood-surfaced fixes to |
Summary
Four fixes surfaced by dogfooding
apify-pp-cliagainst a real Actor (apify/facebook-marketplace-scraper), including a cost-safety gap where a--waitrun reached $2.63 before it could be manually aborted.Findings
auth setup/doctorpointed to an MDN page; now points tohttps://console.apify.com/settings/integrations(the correct URL was already present in the spec's auth prose)run --waitsentwaitForFinish=60on the start POST, exceeding the 30s HTTP client read timeout → "context deadline exceeded while reading body" while the run kept billing. Now caps the server-side block under the client timeout and relies on the existing GET poll loop--max-costcould not protect a first run (no cached history to project from) and nothing capped a live run. Added a live watchdog: under--wait, pollsusageTotalUsdand aborts the run once cost exceeds the capactor-runs abort <runId>only printed parent help; now accepts a run id directly and delegates to theactor-run-postleafChanges
Verification
go build,go vet,govulncheck, manifest, phase5: PASSauth setupprints the Apify console URL;actor-runs abort [runId]accepts a run id;run --waitpolls under a bounded server blockNote: a pre-existing
verify-skillcanonical-sections drift inSKILL.md(untouched by this PR — the CLI was generated on press v4.8.0) remains and needs a regen, separate from these fixes.Patch record
.printing-press-patches/auth-url-wait-cost-watchdog-abort.json— includes adeferred_to_upstreamentry noting F1 is also a generator auth-URL-extraction heuristic bug worth fixing at the machine level.