Tighten `start_or_cancel`'s startup-RTE match
The `'started' in rte.args[0]` check was too loose: it matched a child task's OWN `RuntimeError(...started...)` (not just trio's "child exited without calling task_status.started()"), and would `TypeError` on a non-`str` `args[0]`. Guard with `isinstance(..., str)` and match trio's exact wording so a real child error can't be demoted to `Cancelled` under cancellation. Review: PR #464 (copilot-pull-request-reviewer) https://github.com/goodboy/tractor/pull/464#pullrequestreview-4548203343 (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codetrionics_start_or_cancel
parent
a722d535d9
commit
3fbc77c812
|
|
@ -340,7 +340,16 @@ async def start_or_cancel(
|
||||||
if (
|
if (
|
||||||
rte.args
|
rte.args
|
||||||
and
|
and
|
||||||
'started' in rte.args[0]
|
isinstance(rte.args[0], str)
|
||||||
|
and
|
||||||
|
# match trio's *exact* "child exited without calling
|
||||||
|
# task_status.started()" wording — a bare `'started'`
|
||||||
|
# substring would also match a child task's OWN
|
||||||
|
# `RuntimeError(...started...)` and (under cancellation)
|
||||||
|
# demote it to a `Cancelled`, losing the real error. The
|
||||||
|
# `isinstance` guard also avoids a `TypeError` when
|
||||||
|
# `rte.args[0]` isn't a `str`.
|
||||||
|
'child exited without calling' in rte.args[0]
|
||||||
):
|
):
|
||||||
# re-raises the in-flight `trio.Cancelled` IFF we're
|
# re-raises the in-flight `trio.Cancelled` IFF we're
|
||||||
# under effective cancellation; else a cheap no-op and
|
# under effective cancellation; else a cheap no-op and
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue