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

1.3 KiB

Prompt

Cancel a remote task when its caller is cancelled after Start publication but before startup acknowledgement. Keep cancellation bounded, prevent its private _cancel_task RPC from recursively cancelling itself and preserve public target kwargs unchanged.

Response summary

Add private portal startup policy, use it for non-recursive context cancellation and clean caller-side startup state under a shield.

Files changed

  • tractor/runtime/_portal.py - separate private startup policy.
  • tractor/_context.py - disable recursion for cancellation RPCs.
  • tractor/runtime/_runtime.py - clean cancelled task startup.
  • tests/test_context_stream_semantics.py - control cancellation between Start publication and acknowledgement.

Human edits

The human required this cancellation behavior to remain a distinct commit from general startup failures and from the public to_actor API. The human also requested that its runtime comment describe the actual length-prefixed transport guarantee and concrete _cancel_task operation rather than referring to an unnamed wrapper.