66 lines
2.9 KiB
Markdown
66 lines
2.9 KiB
Markdown
|
|
---
|
||
|
|
model: openai/gpt-5.6-sol
|
||
|
|
service: opencode
|
||
|
|
session: 76c5d31c-5a2f-4503-9b16-410ee7f4fab3
|
||
|
|
timestamp: 2026-08-21T02:35:37Z
|
||
|
|
git_ref: ae6f2ac3
|
||
|
|
scope: code
|
||
|
|
substantive: true
|
||
|
|
raw_file: 20260821T023537Z_ae6f2ac3_prompt_io.raw.md
|
||
|
|
---
|
||
|
|
|
||
|
|
## Prompt
|
||
|
|
|
||
|
|
Simplify bounded actor cancellation by passing an explicit absolute
|
||
|
|
deadline from `Portal.cancel_actor()` through `_run_from_ns()`,
|
||
|
|
`Actor.start_remote_task()`, and `Channel.send()` into
|
||
|
|
`MsgpackTransport.send()`. Avoid a `ContextVar`, watcher tasks, shared
|
||
|
|
status, coalescing, and waiter state. After tracing the current
|
||
|
|
`Start -> StartAck -> CancelAck` transaction, rename the local result to
|
||
|
|
`cancel_ack_received`, document its exact semantics, and link a focused
|
||
|
|
follow-up for a dedicated `Cancel -> CancelAck` protocol.
|
||
|
|
|
||
|
|
## Response summary
|
||
|
|
|
||
|
|
Threaded one absolute Trio deadline through the existing private
|
||
|
|
actor-cancel RPC path. The transport retains complete-frame shielding
|
||
|
|
for ordinary sends, while a cancel-control send that overruns its
|
||
|
|
deadline force-closes the potentially corrupted stream before releasing
|
||
|
|
the send lock. The outer actor-cancel scope uses the same deadline for
|
||
|
|
ack waiting and redelivers pending caller cancellation afterward.
|
||
|
|
|
||
|
|
Renamed the completion flag to `cancel_ack_received` and documented that
|
||
|
|
the current private call consumes `StartAck`, then receives a real
|
||
|
|
`CancelAck` after `Actor.cancel()` completes; this does not establish
|
||
|
|
that the OS process exited. Added a source TODO linking issue #506 for
|
||
|
|
the future first-class `Cancel -> CancelAck` transaction.
|
||
|
|
|
||
|
|
Focused transport and actor-cancel verification passed all four tests.
|
||
|
|
|
||
|
|
## Files changed
|
||
|
|
|
||
|
|
- `tractor/runtime/_portal.py` - own the absolute deadline, accurately
|
||
|
|
record ack receipt, and link the dedicated cancellation protocol.
|
||
|
|
- `tractor/runtime/_runtime.py` - forward the optional deadline for the
|
||
|
|
exact private `Start` publication.
|
||
|
|
- `tractor/ipc/_chan.py` - pass the operation-specific deadline to the
|
||
|
|
transport without changing ordinary sends.
|
||
|
|
- `tractor/ipc/_transport.py` - bound the shielded frame publication and
|
||
|
|
close a partial-frame stream before unlocking it.
|
||
|
|
- `tests/ipc/test_each_tpt.py` - cover deadline expiry after a partial
|
||
|
|
frame prefix reaches the stream.
|
||
|
|
- `tests/test_to_actor.py` - prove actor-cancel publication and ack
|
||
|
|
waiting share one absolute timeout budget.
|
||
|
|
|
||
|
|
## Human edits
|
||
|
|
|
||
|
|
The human rejected the initial watcher-task, shared `_SendStatus`, cancel
|
||
|
|
coalescing, and per-waiter design as unnecessary complexity. They also
|
||
|
|
rejected `ContextVar` propagation in favor of explicit functional
|
||
|
|
threading, selected a single absolute deadline for publication and ack
|
||
|
|
waiting, and required item 2 to remain separate from the item-3 child
|
||
|
|
reaping work. After reviewing the result, they requested the precise
|
||
|
|
`cancel_ack_received` name, a detailed protocol-trace comment, a focused
|
||
|
|
follow-up issue, and a linked source TODO. No direct source-line edits
|
||
|
|
were made by the human.
|