Skip to content

fix: preserve daemon cleanup and capture lifetime proof - #3138

Open
thymikee wants to merge 2 commits into
fix/session-capture-finishfrom
fix/daemon-capture-review-controls
Open

thymikee wants to merge 2 commits into
fix/session-capture-finishfrom
fix/daemon-capture-review-controls

Conversation

@thymikee

@thymikee thymikee commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #3133–#3137 for #3116. Daemon test cleanup stops independently observed children even with corrupt metadata, joins registered successors, and locks registration before deleting a directory. Timeout diagnostics distinguish retained metadata from a process that survived.

Capture bindings retain their own adopted handle after retirement. Cleanup refreshes only the same lifetime before a lazy import; native starts refuse closed admission. The shared fixtures now model lifetime and fence identity. Three capture field adapters live with their binding, fixing the eager-import CI regression.

flowchart LR
  R[Captured lifetime] --> B[Capture binding]
  B --> H[Owned handle]
  B --> C{Current lifetime and fence match?}
  C -->|Yes| U[Update matching slot]
  C -->|No| K[Preserve successor]
Loading

Validation

Head: 0780e5e4c6. 33 changed files; 126 focused tests pass without skips. Ten planted regressions failed, then restored green. All 757 global import-budget tests pass. Lint, typecheck and changed-code Fallow pass. Independent read-only audit found no actionable issues.

All locally runnable affected checks pass; platform/device CI remains GitHub-authoritative.

Review in cubic

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.94 MB 4.94 MB +1.1 kB
Package (unpacked) 4.94 MB 4.94 MB +1.1 kB
Package (download) 1.48 MB 1.48 MB +284 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.7 ms 27.9 ms +0.2 ms
CLI --help 83.7 ms 82.8 ms -0.9 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 33 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/capture-kit/src/durable-capture/transitions.test.ts
Comment thread scripts/layering/session-resource-ownership.ts
@thymikee

thymikee commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

This PR is ready at 0780e5e. All 14 checks pass, and bundle size grows by +1.1 kB unpacked, under the 3 kB threshold. There are no conflicts. I did not rerun the focused tests or the planted mutations, and I judged mutation sensitivity by reading the base code paths. I also did not check whether the fence state that createNextFence mints leaves anything behind on the now-refused start paths. I read only enough to see that it is in-memory. The base is fix/session-capture-finish (#3137), so this review covers only the delta from 1376a9e. Please merge #3137 first. After that, only the notes below remain.

Not blocking, and you can take or leave these: the same admission check (binding.assertAdoptable() after the last await, before the native start) now sits at four sites (record-runtime.ts:156, session-audio.ts:133, session-observability.ts:379 and session-perf-runtime.ts:221), but only perf has a handler-route test, so deleting the record, audio or logs line leaves the suite green. The rule is that no native capture start runs unless the admission check passed after the last await before it. You could parametrize the perf route test over record, audio and logs, or move the assert, start, adopt sequence into one durable-capture-resource helper and test it once. Also, the fixture binding in session-binding.fixtures.ts:59 copies the ownership rules of bindSessionCapture (the retained-handle read fallback and the clear predicate) from session-capture-binding.ts:47-53. Exporting that predicate from capture-kit and using it in both places would keep the transitions tests tied to the shipped rule.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 3, 2026
@thymikee
thymikee added this pull request to stack #3146 October 3, 2026 08:46

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant