--- model: openai/gpt-5.6-sol service: opencode session: ses_3e4c90d3eafeqHEtRYSIHgHhpA timestamp: 2026-08-18T19:30:02Z git_ref: bf06b4f8 scope: code substantive: true raw_file: 20260818T193002Z_bf06b4f8_prompt_io.raw.md --- ## 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 context's 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.