tractor/ai/prompt-io/opencode/20260818T193002Z_bf06b4f8_p...

1.3 KiB
Raw Blame History

Prompt

Distill repeated Actor._contexts.pop() machinery into a wrapper like the RPC-task registration helper so future teardown sites do not keep reconstructing the context-registry key independently. Preserve the existing lifecycle-specific cleanup behavior.

Response summary

Add idempotent Actor._drop_context() registry removal keyed from the contexts own channel and CID. Use it for caller context teardown and the strict callee-side RPC deregistration path.

Files changed

  • tractor/runtime/_runtime.py - own context-registry removal.
  • tractor/runtime/_rpc.py - use the helper for callee teardown.
  • tractor/_context.py - use the helper after caller teardown.

Human edits

The human identified the repeated registry-pop code and requested a central primitive analogous to _register_rpc_task(). The agent first suggested an async helper that also closed receive channels; the final design was narrowed to registry removal only so each lifecycle owner retains its existing closure, debugger, shielding, and error policy.