tractor/ai/prompt-io/prompts/issue_477.md

8 lines
195 B
Markdown
Raw Normal View History

Add `tractor.to_actor` one-shot task API subpkg First cut at the `to_thread`/`to_process`-style "run it over there" wrapper layer from issue #477: a single-remote-task invocation API decoupled from the `ActorNursery` spawn machinery, composed purely from the lower level daemon-actor + portal primitives, - `to_actor.run(fn, **fn_kwargs)` spawns a subactor via `ActorNursery.start_actor()`, schedules `fn` as its lone task with `Portal.run()` and ALWAYS reaps it via a `finally`-scoped `Portal.cancel_actor()` (whose bounded cancel-req wait is internally shielded so the reap also runs under caller-scope cancellation). - remote errors raise directly in the caller's task as boxed `RemoteActorError`s, moving error collection/propagation up into whatever local `trio` scope encloses the call. - "placement" opts: `portal=` reuses a running actor (no spawn/reap), `an=` spawns from a caller-managed actor-nursery, neither opens a private call-scoped `open_nursery()` (implicitly booting the runtime, tunable via pass-through `runtime_kwargs`). - fail-fast validation BEFORE any spawn: non-streaming async fn only (same constraint as `Portal.run()`), `portal=`/`an=` mutual exclusion and no `runtime_kwargs` alongside a placement opt. Also, - x-ref the successor API from `.run_in_actor()`'s deprecation TODO + docstring; emitting a formal `DeprecationWarning` waits on migrating in-repo usage. - log prompt-io provenance per NLNet policy incl. the driver prompt file. Prompt-IO: ai/prompt-io/claude/20260702T154255Z_65bf9df5_prompt_io.md (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code
2026-07-02 16:10:19 +00:00
NOTE: you MUST pause this work at 12:50PM EST (BEFORE your weekly
limit reset) for review by a human!
---
attempt to resolve https://github.com/goodboy/tractor/issues/477
do it with /open-wkt.