fix(daemon): stop branch-named daemon before replacement - #2015
Conversation
Size Report
npm unpacked components
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. Top changed packed files
|
|
Code review is clean at Not ready for human merge yet: the iOS smoke lane is red on unrelated |
|
The new iOS smoke rerun is green and all current checks pass, but re-reviewing unchanged head P1 — missing process identity fails open during takeover. Make start time mandatory for process ownership and reaping: missing identity must fail closed, allowing stale metadata removal but no signal. Add a real-child regression with omitted Separately, #2015 remains stacked on conflicting #2004. After this finding is fixed, #2004 must land/rebase and #2015 must be retargeted or rebased before merge. No readiness label applied. |
|
Still not ready at unchanged head |
0b143a8 to
d124858
Compare
|
Addressed the ownership-safety P1 and rebased onto the current #2004 head.
Current head: |
|
Addressed the ownership-safety P1 and rebased onto the current #2004 head.\n\n- and now require an explicit process-start-time identity slot and fail closed when it is undefined; no signal is sent without the fence.\n- Added a real-child regression proving a branch-named daemon remains alive when is omitted, alongside the exact-start-time replacement proof.\n- The planted-red version failed at the omitted-identity assertion; focused daemon/client coverage is 44/44.\n- Final elevated [WARN] This project is configured to use 11.17.0 of pnpm. Your current pnpm is v11.21.0
[skip] test-app-typecheck — GitHub-authoritative (jobs: Test App Build Cache / Resolve native fingerprint) [skip] unit-ci — GitHub-authoritative (jobs: Coverage, Coverage Report, Integration Tests) [skip] coverage — GitHub-authoritative (jobs: Coverage Report) [skip] swift-runner-ios — GitHub-authoritative (jobs: Conformance Differential / iOS Conformance Differential, XCTest Nightly / iOS Runner Full XCTest Suite, iOS / Smoke Tests) [skip] swift-runner-macos — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] android-helpers — GitHub-authoritative (jobs: Android / Smoke Tests) [skip] macos-helper — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] web-smoke — GitHub-authoritative (jobs: Integration Tests, Typecheck & Package) [skip] freerange — GitHub-authoritative (jobs: Repo Guards) [skip] maestro-differential — GitHub-authoritative (jobs: Conformance Differential / iOS Conformance Differential) [skip] maestro-regenerate — GitHub-authoritative (jobs: Conformance Regenerate Verify / Regenerate & Verify Fixtures) [skip] fuzz-parsers — GitHub-authoritative (jobs: Replay Nightly / Parser Fuzz Lane) [skip] mutation — GitHub-authoritative (jobs: Mutation Affected / Mutants (${{ matrix.name }}), Mutation Weekly / Mutants (${{ matrix.name }})) [skip] mutation-affected — GitHub-authoritative (jobs: Mutation Affected / Select affected kernels) [skip] mutation-check — GitHub-authoritative (jobs: Mutation Weekly / Mutation score report) [skip] concurrency-torture — GitHub-authoritative (jobs: Concurrency Torture Nightly / Session/lease/lock torture sweep, Integration Tests) [skip] replay-ios — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-ios-device — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-macos — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] replay-linux — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] linux-command-evidence — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] replay-android — parked, workflow_dispatch only (Replay Manual / Android Full Emulator Suite) [run] format: pnpm run format:check All matched files use the correct format. [run] lint: pnpm run lint [run] typecheck: pnpm run typecheck [run] layering: pnpm run check:layering [run] di-seams: pnpm run check:di-seams [run] fallow: pnpm run check:fallow --base origin/main [run] mcp-metadata: pnpm run check:mcp-metadata [run] build: pnpm run build [run] package: pnpm run check:package [run] integration-node: pnpm run test:integration:node [run] macos-coverage: pnpm run test:integration:macos-coverage [run] vitest-related: pnpm exec vitest related --run --passWithNoTests --maxWorkers=2 packages/contracts/src/facades/divergence.ts packages/contracts/src/replay-divergence.test.ts packages/contracts/src/replay-divergence.ts src/tests/eager-closure-budgets.ts src/daemon/tests/code-signature-cache.test.ts src/daemon/tests/daemon-process-takeover.test.ts src/daemon/tests/daemon-process.test.ts src/daemon/client/tests/daemon-launch-spec.test.ts src/daemon/client/daemon-client-lifecycle.ts src/daemon/client/daemon-launch-spec.ts src/daemon/code-signature-cache.ts src/daemon/code-signature.ts src/daemon/daemon-process.ts src/daemon/session-replay-coordinator.ts src/utils/tests/daemon-client.test.ts src/utils/tests/version.test.ts src/utils/version.ts test/integration/smoke-web-platform.test.ts vitest.config.ts RUN v4.1.11 /Users/thymikee/.codex/worktrees/572f/agent-device ✓ |interaction-contract| test/integration/interaction-contract/coordinate.contract.test.ts (6 tests) 3196ms Test Files 457 passed (457) [dedupe] unit — covered by related tests or GitHub CI [dedupe] provider-integration — covered by related tests or GitHub CI [run] integration-progress: pnpm run test:integration:progress:check
Mock-heavy handler unit tests
Public CLI flag coverage outside provider-backed integration
Provider transcript pressure
[run] replay-compat: pnpm run check:replay-compat [run] daemon-wire-compat: pnpm run check:daemon-wire-compat [run] affected-selector: pnpm run check:affected:test [skip] web-smoke — GitHub-authoritative (jobs: Integration Tests, Typecheck & Package) [skip] replay-ios — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-ios-device — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-macos — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] replay-linux — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] linux-command-evidence — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] replay-android — parked, workflow_dispatch only (Replay Manual / Android Full Emulator Suite) [run] format: pnpm run format:check [run] lint: pnpm run lint check:affected: lint failed. [skip] web-smoke — GitHub-authoritative (jobs: Integration Tests, Typecheck & Package) [skip] replay-ios — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-ios-device — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-macos — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] replay-linux — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] linux-command-evidence — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] replay-android — parked, workflow_dispatch only (Replay Manual / Android Full Emulator Suite) [run] format: pnpm run format:check [run] lint: pnpm run lint [run] typecheck: pnpm run typecheck [run] layering: pnpm run check:layering [run] fallow: pnpm run check:fallow --base origin/main [run] build: pnpm run build [run] vitest-related: pnpm exec vitest related --run --passWithNoTests --maxWorkers=2 packages/selectors/src/index.ts packages/selectors/src/index.test.ts check:affected: all runnable checks passed. [skip] test-app-typecheck — GitHub-authoritative (jobs: Test App Build Cache / Resolve native fingerprint) [skip] unit-ci — GitHub-authoritative (jobs: Coverage, Coverage Report, Integration Tests) [skip] coverage — GitHub-authoritative (jobs: Coverage Report) [skip] swift-runner-ios — GitHub-authoritative (jobs: Conformance Differential / iOS Conformance Differential, XCTest Nightly / iOS Runner Full XCTest Suite, iOS / Smoke Tests) [skip] swift-runner-macos — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] android-helpers — GitHub-authoritative (jobs: Android / Smoke Tests) [skip] macos-helper — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] web-smoke — GitHub-authoritative (jobs: Integration Tests, Typecheck & Package) [skip] freerange — GitHub-authoritative (jobs: Repo Guards) [skip] maestro-differential — GitHub-authoritative (jobs: Conformance Differential / iOS Conformance Differential) [skip] maestro-regenerate — GitHub-authoritative (jobs: Conformance Regenerate Verify / Regenerate & Verify Fixtures) [skip] fuzz-parsers — GitHub-authoritative (jobs: Replay Nightly / Parser Fuzz Lane) [skip] mutation — GitHub-authoritative (jobs: Mutation Affected / Mutants (${{ matrix.name }}), Mutation Weekly / Mutants (${{ matrix.name }})) [skip] mutation-affected — GitHub-authoritative (jobs: Mutation Affected / Select affected kernels) [skip] mutation-check — GitHub-authoritative (jobs: Mutation Weekly / Mutation score report) [skip] concurrency-torture — GitHub-authoritative (jobs: Concurrency Torture Nightly / Session/lease/lock torture sweep, Integration Tests) [skip] replay-ios — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-ios-device — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-macos — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] replay-linux — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] linux-command-evidence — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] replay-android — parked, workflow_dispatch only (Replay Manual / Android Full Emulator Suite) [run] format: pnpm run format:check [run] lint: pnpm run lint [run] typecheck: pnpm run typecheck [run] layering: pnpm run check:layering [run] di-seams: pnpm run check:di-seams [run] fallow: pnpm run check:fallow --base origin/main [run] mcp-metadata: pnpm run check:mcp-metadata [run] build: pnpm run build [run] package: pnpm run check:package [run] integration-node: pnpm run test:integration:node [run] macos-coverage: pnpm run test:integration:macos-coverage [run] vitest-related: pnpm exec vitest related --run --passWithNoTests --maxWorkers=2 [dedupe] unit — covered by related tests or GitHub CI [dedupe] provider-integration — covered by related tests or GitHub CI [run] integration-progress: pnpm run test:integration:progress:check [run] replay-compat: pnpm run check:replay-compat [run] daemon-wire-compat: pnpm run check:daemon-wire-compat [run] affected-selector: pnpm run check:affected:test [run] gate-manifest: pnpm run check:gate-manifest [run] gate-manifest-model: pnpm run check:gate-manifest:test [run] depgraph: pnpm run depgraph:test [run] tmpdir-leaks: pnpm run check:tmpdir-leaks [run] tmpdir-leaks-model: pnpm run check:tmpdir-leaks:test [run] coverage-model: pnpm run check:coverage-changed:test [run] wire-compat-model: pnpm run check:daemon-wire-compat:test [run] production-exports: pnpm run check:production-exports [run] bundle-owner-files: pnpm run check:bundle-owner-files [run] fixture-cache: pnpm run test:fixture-cache [run] fixture-fallback: pnpm run test:fixture-fallback [run] command-docs: pnpm run check:command-docs [run] agent-guidance: pnpm run check:agent-guidance [run] xctest-selection: pnpm run check:xctest-selection [run] maestro-conformance: pnpm run maestro:conformance [run] mutation-model: pnpm run mutation:test check:affected: all runnable checks passed. [skip] test-app-typecheck — GitHub-authoritative (jobs: Test App Build Cache / Resolve native fingerprint) [skip] unit-ci — GitHub-authoritative (jobs: Coverage, Coverage Report, Integration Tests) [skip] coverage — GitHub-authoritative (jobs: Coverage Report) [skip] swift-runner-ios — GitHub-authoritative (jobs: Conformance Differential / iOS Conformance Differential, XCTest Nightly / iOS Runner Full XCTest Suite, iOS / Smoke Tests) [skip] swift-runner-macos — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] android-helpers — GitHub-authoritative (jobs: Android / Smoke Tests) [skip] macos-helper — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] web-smoke — GitHub-authoritative (jobs: Integration Tests, Typecheck & Package) [skip] freerange — GitHub-authoritative (jobs: Repo Guards) [skip] maestro-differential — GitHub-authoritative (jobs: Conformance Differential / iOS Conformance Differential) [skip] maestro-regenerate — GitHub-authoritative (jobs: Conformance Regenerate Verify / Regenerate & Verify Fixtures) [skip] fuzz-parsers — GitHub-authoritative (jobs: Replay Nightly / Parser Fuzz Lane) [skip] mutation — GitHub-authoritative (jobs: Mutation Affected / Mutants (${{ matrix.name }}), Mutation Weekly / Mutants (${{ matrix.name }})) [skip] mutation-affected — GitHub-authoritative (jobs: Mutation Affected / Select affected kernels) [skip] mutation-check — GitHub-authoritative (jobs: Mutation Weekly / Mutation score report) [skip] concurrency-torture — GitHub-authoritative (jobs: Concurrency Torture Nightly / Session/lease/lock torture sweep, Integration Tests) [skip] replay-ios — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-ios-device — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-macos — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] replay-linux — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] linux-command-evidence — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] replay-android — parked, workflow_dispatch only (Replay Manual / Android Full Emulator Suite) [run] format: pnpm run format:check [run] lint: pnpm run lint [run] typecheck: pnpm run typecheck [run] layering: pnpm run check:layering [run] di-seams: pnpm run check:di-seams [run] fallow: pnpm run check:fallow --base origin/main [run] mcp-metadata: pnpm run check:mcp-metadata [run] build: pnpm run build [run] package: pnpm run check:package [run] integration-node: pnpm run test:integration:node [run] macos-coverage: pnpm run test:integration:macos-coverage [run] vitest-related: pnpm exec vitest related --run --passWithNoTests --maxWorkers=2 [dedupe] unit — covered by related tests or GitHub CI [dedupe] provider-integration — covered by related tests or GitHub CI [run] integration-progress: pnpm run test:integration:progress:check [run] replay-compat: pnpm run check:replay-compat [run] daemon-wire-compat: pnpm run check:daemon-wire-compat [run] affected-selector: pnpm run check:affected:test [run] gate-manifest: pnpm run check:gate-manifest [run] gate-manifest-model: pnpm run check:gate-manifest:test [run] depgraph: pnpm run depgraph:test [run] tmpdir-leaks: pnpm run check:tmpdir-leaks [run] tmpdir-leaks-model: pnpm run check:tmpdir-leaks:test [run] coverage-model: pnpm run check:coverage-changed:test [run] wire-compat-model: pnpm run check:daemon-wire-compat:test [run] production-exports: pnpm run check:production-exports [run] bundle-owner-files: pnpm run check:bundle-owner-files [run] fixture-cache: pnpm run test:fixture-cache [run] fixture-fallback: pnpm run test:fixture-fallback [run] command-docs: pnpm run check:command-docs [run] agent-guidance: pnpm run check:agent-guidance [run] xctest-selection: pnpm run check:xctest-selection [run] maestro-conformance: pnpm run maestro:conformance [run] mutation-model: pnpm run mutation:test check:affected: all runnable checks passed. check:affected: node_modules does not match this worktree's pnpm-lock.yaml check:affected: node_modules does not match this worktree's pnpm-lock.yaml [skip] web-smoke — GitHub-authoritative (jobs: Integration Tests, Typecheck & Package) [skip] replay-ios — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-ios-device — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-macos — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] replay-linux — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] linux-command-evidence — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] replay-android — parked, workflow_dispatch only (Replay Manual / Android Full Emulator Suite) [run] format: pnpm run format:check [run] lint: pnpm run lint [run] typecheck: pnpm run typecheck [run] layering: pnpm run check:layering [run] fallow: pnpm run check:fallow --base origin/main [run] build: pnpm run build [run] vitest-related: pnpm exec vitest related --run --passWithNoTests --maxWorkers=2 check:affected: all runnable checks passed. [skip] web-smoke — GitHub-authoritative (jobs: Integration Tests, Typecheck & Package) [skip] replay-ios — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-ios-device — parked, workflow_dispatch only (Replay Manual / iOS Replay Suite) [skip] replay-macos — GitHub-authoritative (jobs: macOS / Smoke Tests) [skip] replay-linux — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] linux-command-evidence — GitHub-authoritative (jobs: Linux / Smoke Tests) [skip] replay-android — parked, workflow_dispatch only (Replay Manual / Android Full Emulator Suite) [run] format: pnpm run format:check [run] lint: pnpm run lint [run] typecheck: pnpm run typecheck [run] layering: pnpm run check:layering [run] fallow: pnpm run check:fallow --base origin/main [run] build: pnpm run build [run] vitest-related: pnpm exec vitest related --run --passWithNoTests --maxWorkers=2 check:affected: all runnable checks passed. [run] gate-manifest: pnpm run check:gate-manifest [run] gate-manifest-model: pnpm run check:gate-manifest:test [run] depgraph: pnpm run depgraph:test [run] tmpdir-leaks: pnpm run check:tmpdir-leaks [run] tmpdir-leaks-model: pnpm run check:tmpdir-leaks:test [run] coverage-model: pnpm run check:coverage-changed:test [run] wire-compat-model: pnpm run check:daemon-wire-compat:test [run] production-exports: pnpm run check:production-exports ● Unused exports (33) [run] bundle-owner-files: pnpm run check:bundle-owner-files [run] fixture-cache: pnpm run test:fixture-cache [run] fixture-fallback: pnpm run test:fixture-fallback [run] command-docs: pnpm run check:command-docs RUN v4.1.11 /Users/thymikee/.codex/worktrees/572f/agent-device ✓ |unit-core| src/tests/command-doc-coverage.test.ts (11 tests) 4ms Test Files 1 passed (1) [run] agent-guidance: pnpm run check:agent-guidance [run] xctest-selection: pnpm run check:xctest-selection [run] maestro-conformance: pnpm run maestro:conformance [run] mutation-model: pnpm run mutation:test check:affected: all runnable checks passed. passed all runnable checks (457 Vitest files / 3,911 tests; 92 integration-node tests with 9 live-device skips).\n\nCurrent head: ; CI is running. |
d124858 to
26ef934
Compare
|
Coverage (1) failed only because the file-size ratchet caught The focused suite now passes 47/47, and the elevated |
|
Re-reviewed P1 — the web shutdown smoke's guaranteed cleanup can no longer stop its daemon. Current CI is rerunning after the size fix. No |
|
Re-reviewed exact head |
|
Summary
Closes #1545.
Git-worktree daemon processes are now recognized by their daemon entry path instead of requiring
agent-devicein the checkout path. This lets the existing platform-neutral daemon-client reuse/takeover path recognize a daemon launched from a branch-named worktree; when replacement is warranted, it can stop the predecessor instead of leaving an invisible daemon holding the old session state and leases.Process ownership and reaping now require an explicit process-start-time identity slot and fail closed when metadata omits that identity. Missing identity can therefore remove stale metadata but cannot authorize a signal. This PR does not touch or duplicate #2004's in-flight dev code-signature cache/identity seam.
This PR is rebased onto the current open #2004 dependency,
tier4/daemon-client-fingerprintat44e80ea1704ef6eca79ee999eb3ee4d83503c08a.Scope is seven touched files: the daemon-process ownership predicate, pure and real-child regression tests, the existing daemon-client process fixture, the file-size ratchet pin, the existing web-smoke cleanup call's explicit identity slot, and serialized subprocess-test registration. No platform implementation, code-signature calculation/cache, CLI surface, docs, or skills changed. The duplicate legacy takeover test was removed from the over-budget daemon-client test file because the dedicated daemon-process takeover suite now owns the stronger real-child proof.
Validation
Coverage (1)job failed only the file-size ratchet aftersrc/utils/__tests__/daemon-client.test.tsgrew to 1922 lines. The redundant duplicate test was removed, the file is now 1873 lines, and its ratchet pin was lowered from 1910 to the exact measured size.true !== false) atisAgentDeviceDaemonProcess(pid, undefined); restoring the guard made it pass. This proves the missing-identity regression test has a reachable violation.pnpm exec vitest run --project unit-core --project subprocess-stub scripts/__tests__/test-file-size-ratchet.test.ts src/utils/__tests__/daemon-client.test.ts src/daemon/__tests__/daemon-process.test.ts src/daemon/__tests__/daemon-process-takeover.test.tspassed 47/47 tests, including exact-start-time takeover, omitted-start-time child-preservation, and the ratchet.pnpm check:affected --runpassed all runnable checks, including format, lint, typecheck, layering, fallow, build, package, 92 integration-node tests (9 live-device tests skipped), 7 macOS coverage tests, 458 Vitest files / 3,914 tests, and all structural/model gates. An earlier sandboxed attempt stopped at the knownpssubprocessEPERM; the same gate passed with process access.pnpm ad session list --jsoninvocations reused one daemon state directory and one matching worktree daemon process. The exact historical code-signature-mismatch/session-loss repro was not reproduced on this host; no live device or app session was used.claude -padversarial review was attempted against the final diff, but the CLI reportedNot logged in, so no external review result is claimed. A bounded local audit checked every ownership/signal call path, explicit identity propagation, path normalization/quoting, nearest negatives, real-child behavior, and perf(daemon): revalidate the source code-signature cache by stat instead of rereading the graph #2004 seam ownership.Residual gaps are the GitHub-authoritative native/device/provider lanes and the exact OS-specific process-table repro not being available in this environment. The previous CI failure was isolated to the file-size ratchet above; the corrected head is being pushed for GitHub to rerun. This PR is not merged.