Skip to content

Include owned child stacks in claim cancellation failures - #1025

Merged
zlareb1 merged 4 commits into
mainfrom
fix/claim-cancel-evidence-20261120
Nov 21, 2026
Merged

zlareb1 merged 4 commits into
mainfrom
fix/claim-cancel-evidence-20261120

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Why

A claim-release cancellation failure can leave only the event-loop selector in its thread stack. That stack cannot distinguish a suspended prompt from retirement cleanup. The failed exit check also records bounded coroutine frames, cancellation counts, signal state and lifecycle counters from its owned child.

The cause of the cancellation failure remains unknown. This change supplies evidence; it does not fix command cancellation.

Scope and risk

Only the native-command test fixture changes. The trace retains its all-thread stack and adds at most eight tasks with eight frames each. Frame names and file names are capped at 64 characters, and an encoded packet above 32,700 bytes is replaced by a fixed truncation marker. Arguments, locals, task names, input, environment values and exception text are excluded. Observer errors emit a fixed failure marker when the trace remains writable.

The existing cancellation test adds diagnostics only after its five-second exit deadline has failed, then still fails the test. All 53 original assertions and the ten-second prompt deadline remain unchanged. The new coroutine collector and controls retain the prior thread-diagnostic version of all five test bodies, covering 14 cases. A separate control begins with an already-cancelled command suspended before cleanup; it tests the observer without adding another prompt-signal timing race.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none.
  • Rollback: reverting removes test diagnostics and controls.

Tests

  • Controlled observer regression: the thread-only collector fails to expose the suspended coroutine; enabling the async-state collector passes.
  • .venv/bin/python -m pytest tests/unit/test_native_command_retirement.py -q -p no:randomly: 18 passed.
  • Scoped Ruff checks, formatting, prose and diff checks pass.
  • AST comparison retains all original assertions and the prompt-wait helper. The prior thread-diagnostic version of all five test bodies is unchanged by the coroutine collector.
  • Full hosted CI and a fresh independent review are required on the final public head.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Codex; checked the signal path, output bounds, original test bodies and failure preservation.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are unaffected.
  • No migration changes.
  • No shipped plugin changes.
  • No frontend changes.
  • No operator steps or wire changes.
  • Repository text has no deployment details.
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

@zlareb1
zlareb1 force-pushed the fix/claim-cancel-evidence-20261120 branch 2 times, most recently from c74ea94 to 00c9e87 Compare November 20, 2026 22:25
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Nov 21, 2026 12:33am UTC

Request Review

@zlareb1
zlareb1 force-pushed the fix/claim-cancel-evidence-20261120 branch from 00c9e87 to 41806d6 Compare November 20, 2026 23:07
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
@zlareb1
zlareb1 force-pushed the fix/claim-cancel-evidence-20261120 branch from 41806d6 to 85f66ef Compare November 21, 2026 00:08
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
@zlareb1
zlareb1 merged commit dd0dccd into main Nov 21, 2026
49 checks passed
zlareb1 added a commit that referenced this pull request Nov 21, 2026
Related: #1072
Related: #1025

### Changelog category (leave one):

- CI Fix or Improvement (changelog entry is not required)

### Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Not required.

### Why

A failed claim cancellation can leave a task with one cancellation request while it still waits for input. The failure trace needs the waiter's state to distinguish a consumed request from a cancelled waiter awaiting its task's next step.

### Scope and risk

Only the claim cancellation test's failure observer changes. It records fixed task and waiter booleans, plus the pending cancellation flag when the runtime exposes it. Task names, arguments, local values, input and exception content stay out of the packet. The existing task, frame and byte limits remain.

This adds diagnostic evidence; it does not establish or repair the cancellation failure's cause. The command, signal tests, stdin behavior, lifecycle assertions and exit deadlines are unchanged.

### Compatibility, rollout and rollback

- Wire: none.
- Operator steps: none.
- Rollback: reverting leaves no stored data or generated files.

### Tests

Two isolated controls fail with missing observer fields before the change and pass after it. They distinguish a cancelled waiter before task resumption from a consumed cancellation followed by a fresh waiter.

The five selected observer and privacy cases pass. Scoped Ruff, format, prose and whitespace checks pass. An AST comparison verifies that every existing test and helper except the observer is unchanged, that all original assertions remain, and that the two new controls match their failing versions.

Full hosted CI and a fresh independent review are required after publication. The natural signal race and the claim subprocess tests were not repeated locally.

### AI assistance in the code (leave one; writing this description with AI is fine):

- AI-generated: Codex wrote the observer fields and isolated controls. The source diff, regression failures, focused results and preservation proof were checked.

- [x] I can explain every line of this diff and how it interacts with the rest of Loom.

### Checklist

- [ ] Full format, lint, type and unit gates pass in hosted CI before merge.
- [x] No generated files, migrations, plugin files, frontend code, runtime configuration or wire behavior change.
- [x] Public text passes the prose check.
- [x] The commit is signed off.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant