Skip to content

Harden watcher consumption and adopt bounded Tilt watch delivery - #292

Merged
David Negstad (danegsta) merged 7 commits into
mainfrom
danegsta-dcp-watcher-consumption
Oct 19, 2026
Merged

David Negstad (danegsta) merged 7 commits into
mainfrom
danegsta-dcp-watcher-consumption

Conversation

@danegsta

@danegsta David Negstad (danegsta) commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Summary

An unread watch can stall tilt-apiserver storage publication and unrelated watcher shutdown. DCP also had a consumption gap of its own: the V2 Namespace lifecycle watcher opened a watch before listing Namespaces, but did not consume events until the list completed.

Keep the Namespace watch draining independently during snapshot requests and shutdown, with coalesced deletion/error notifications and authoritative snapshots driving lifecycle decisions. Also initialize LogStorage's disposal signal and allocate per-resource watchers only after parent-watch setup succeeds.

Update tilt-apiserver from v0.19.1 to the released v0.19.2, which includes bounded, asynchronous watcher delivery and follow-up simplifications from tilt-dev/tilt-apiserver#117 and tilt-dev/tilt-apiserver#118. No fork replacement or pseudo-version remains. Checksums and the dependency notice are updated.

Remove TestV2NamespaceLifecycleStorageHoldsDeleteLeaseAfterHTTPTimeout, which depends on the old unread-watch publication stall and no longer represents the adopted behavior.

Merge current main, including the Aspire regression scaffolding fixes from #301. The Aspire regression files now match main and are no longer part of this PR's diff.

Related to #286, without marking it resolved or adding a closing reference. The dependency contains the upstream publication fix, but this is not a claim that the original Aspire CI scenario has been reproduced and verified.

Validation

  • DCP builds against released Tilt v0.19.2; module checksums verify successfully. API storage and API-server package tests pass without skipping any tests.
  • Real DCP HTTP/2 smoke tests pass on Windows and Linux against v0.19.2: 200 updates with 128 KiB payloads complete beside an unread watch, a healthy watch receives every update in order, another Executable can be created, the stalled watch is evicted, and a replacement sees current state. The original Tilt v0.19.1 dependency stalls under the same probe.
  • Repository lint passes for Windows, macOS, and Linux. Code generation produced no content changes; dependency notices were regenerated.
  • The full unit/integration suite was run against v0.19.2. Integration tests pass, but the overall local Windows run encounters the previously observed TestProcessExecutableRunnerBoundsInheritedOutputPipeWait and TestForkFromParentBreaksAwayFromCurrentJob failures. Neither process implementation is changed by this PR.
  • The actual Aspire E2E regression runs in CI, not locally.

Keep the V2 Namespace watch draining during snapshot requests, coalesce refresh notifications, and join the reader on shutdown. Initialize LogStorage disposal signaling and avoid allocating resource watchers before parent watch setup succeeds.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 4667f368-688b-4dbb-bea1-af8c03f8438a

Copilot AI 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.

🔵 Needs a closer look

The timing-sensitive concurrency and shutdown changes affect core API-server lifecycle behavior and warrant final human review.

0 open findings

What changed in this PR

Hardens API-server watch consumption and cleanup without resolving the upstream publication issue in #286.

Changes:

  • Continuously drains Namespace watch events during listing and shutdown.
  • Coalesces deletion/error notifications and improves cancellation handling.
  • Makes LogStorage disposal safe and avoids orphan watchers after setup failures.
File Description
internal/​apiserver/​v2_namespace_lifecycle_watcher.go Adds independent watch draining and coordinated shutdown.
internal/​apiserver/​v2_namespace_lifecycle_watcher_test.go Covers slow lists, failures, cancellation, and event coalescing.
internal/​apiserver/​v2_namespace_lifecycle_storage_test.go Safely drains the test watch during cleanup.
api/​v1/​log_storage.go Initializes disposal signaling and reorders watcher allocation.
api/​v1/​log_storage_test.go Tests setup retries and disposal without a parent watch.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Use the immutable fork revision from tilt-dev/tilt-apiserver#117 until the fixes are available upstream. Refresh dependency checksums and notices, remove the test that relies on synchronous watch publication blocking deletion, and update comments for asynchronous delivery.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 4667f368-688b-4dbb-bea1-af8c03f8438a
@danegsta David Negstad (danegsta) changed the title Harden DCP watcher consumption and lifecycle cleanup Harden watcher consumption and adopt bounded Tilt watch delivery Oct 14, 2026
Keep all scaffolded build directives when inserting the regression AppHost body, supporting both SDK-based and package-based daily templates. Require an SDK or package directive rather than assuming Aspire.AppHost.Sdk is present.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 4667f368-688b-4dbb-bea1-af8c03f8438a
Preserve scaffolded build directives without requiring a particular directive type or any directives at all. Let Aspire and .NET interpret the generated AppHost configuration.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 4667f368-688b-4dbb-bea1-af8c03f8438a

Copilot AI 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.

🔵 Needs a closer look

The unmerged dependency fork changes core concurrent watch delivery semantics and requires final human validation.

0 open findings

🧠 Review effort: Balanced

David Negstad (danegsta) added a commit that referenced this pull request Oct 15, 2026
Preserve all build directives selected by the daily CLI template instead of requiring an explicit SDK directive. Leave generated AppHost validation to Aspire, supporting package-based templates without importing the unrelated watcher or dependency changes from PR #292.

Co-authored-by: Copilot App <[email protected]>
Reference tilt-dev/tilt-apiserver commit d35b179a41c077755089e03ce5a7b40b922b75ce directly through its upstream pseudo-version. Remove the temporary fork replacement and update checksums and dependency notices.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 4667f368-688b-4dbb-bea1-af8c03f8438a
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 4667f368-688b-4dbb-bea1-af8c03f8438a
Use the released bounded watch delivery fixes instead of the upstream pseudo-version. Refresh module checksums and dependency notices.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 4667f368-688b-4dbb-bea1-af8c03f8438a
@danegsta
David Negstad (danegsta) merged commit 06562f3 into main Oct 19, 2026
12 checks passed
@danegsta
David Negstad (danegsta) deleted the danegsta-dcp-watcher-consumption branch October 19, 2026 22:03
@danegsta

Copy link
Copy Markdown
Member Author

/backport to release/0.26

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

David Negstad (@danegsta) backporting to release/0.26 failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Harden DCP watcher consumption and lifecycle cleanup
Applying: Temporarily pin bounded Tilt watch delivery fixes
Applying: Preserve package-based Aspire scaffold directives
Using index info to reconstruct a base tree...
M	test/aspire/apphost-body.cs
M	test/aspire/run-regression.sh
Falling back to patching base and 3-way merge...
Auto-merging test/aspire/run-regression.sh
CONFLICT (content): Merge conflict in test/aspire/run-regression.sh
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0003 Preserve package-based Aspire scaffold directives
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

@danegsta

Copy link
Copy Markdown
Member Author

/backport to release/0.27

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

David Negstad (@danegsta) backporting to release/0.27 failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Harden DCP watcher consumption and lifecycle cleanup
Applying: Temporarily pin bounded Tilt watch delivery fixes
Applying: Preserve package-based Aspire scaffold directives
Using index info to reconstruct a base tree...
M	test/aspire/apphost-body.cs
M	test/aspire/run-regression.sh
Falling back to patching base and 3-way merge...
Auto-merging test/aspire/run-regression.sh
CONFLICT (content): Merge conflict in test/aspire/run-regression.sh
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0003 Preserve package-based Aspire scaffold directives
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

David Negstad (danegsta) added a commit that referenced this pull request Oct 19, 2026
…h delivery (#307)

Backport PR #292 (06562f3) onto release/0.26 without merging main or unrelated release/0.27 feature work.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a9488cee-a143-4b72-b788-d9d0d2f7004e
David Negstad (danegsta) added a commit that referenced this pull request Oct 20, 2026
…h delivery (#308)

Backport #292 to release/0.27 using the merged squash commit. This avoids replaying intermediate Aspire scaffolding changes that are absent from the final merged patch.

(cherry picked from commit 06562f3)

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: dc3cf879-f807-4f97-a589-397da07f0115
David Negstad (danegsta) added a commit that referenced this pull request Oct 30, 2026
* Add V2 logical container resource foundation

Introduce logical container and network APIs, delegate logical container lifecycle operations to physical resources, and track persistent workload ownership. Standardize V2 deletion dispatch and terminal startup/stop outcomes with shared API-backed coverage.

Co-authored-by: Copilot App <[email protected]>

* Replace synthetic V2 controller tests with behavioral coverage

Exercise logical readiness through the shared API server and running physical controller using runtime port-mapping fault injection. Remove redundant private deletion-handler tests already covered by retained-resource integration cases.

Co-authored-by: Copilot App <[email protected]>

* Preserve lifecycle duplicate precedence and honor namespace workload IDs

Use stable key sorting for logical container environment, container labels, and build labels. Resolve namespace workload overrides during asynchronous persistent ownership settlement, retaining startup leases on lookup or recording errors and supporting overrides without a global default.

Co-authored-by: Copilot App <[email protected]>

* Import Aspire regression scaffold compatibility fix from #292

Preserve all build directives selected by the daily CLI template instead of requiring an explicit SDK directive. Leave generated AppHost validation to Aspire, supporting package-based templates without importing the unrelated watcher or dependency changes from PR #292.

Co-authored-by: Copilot App <[email protected]>

* Release logical container realization inputs after physical handoff

Make the selected runtime ID explicitly pending and clear it together with the generated session name after physical creation or verification. Project inline image references from the physical creation spec instead of retaining an adopted runtime ID as a marker.

Co-authored-by: Copilot App <[email protected]>

* Capture logical and physical container system diagnostics

Add scoped resource-stream nesting that preserves context, primary bindings, filters, and independent cleanup. Bind V2 container diagnostics by resource UID and forward owned physical container diagnostics to the logical owner's stream, including asynchronous operation failures. Keep resource-file producer names per entry and verify fanout without duplicate process or resource entries. This provides capture and routing only; V2 log subresource registration remains separate.

Co-authored-by: Copilot App <[email protected]>

* Expose namespaced V2 container log endpoints

Share watch-driven log storage and query handling across API versions while preserving V1 contracts. Add logical and physical container stdout, stderr, and system streamers with one physical-UID runtime capture, snapshot-only logical source resolution, independent client lifetimes, namespace preservation, and explicit unsupported-source errors. Project backing physical identity into logical status and exercise actual endpoints, cancellation, and existing V1 log behavior.

Co-authored-by: Copilot App <[email protected]>

* Drive namespace cleanup directly from relational metadata

Replace per-kind cleanup handlers with one uncached list and bounded delete executor, preserving dependency ordering and pending-resource diagnostics.

Co-authored-by: Copilot App <[email protected]>

* Keep V2 container log subresources with their parent types

Declare logical and physical container log subresources alongside their parents, retaining only resource-neutral storage construction and contracts in shared log types.

Co-authored-by: Copilot App <[email protected]>

* Use container-specific filenames for V2 log streaming

Co-authored-by: Copilot App <[email protected]>

* Expose V2 image acquisition logs through shared capture sources

Capture pull and build output, serialize image acquisition with exclusive leases, and project image startup and container runtime sources directly onto logical resources. Preserve the V1 watcher handoff, fix nested resource sink failure reporting, and share CaptureFile between V1 and V2 controllers.

Co-authored-by: Copilot App <[email protected]>

* Rename shared V2 logging package for resource consumers

Co-authored-by: Copilot App <[email protected]>

* Complete logical container log sources when physical backing disappears

Preserve the original physical source identity in a completed, unavailable descriptor so logical-only followers finish through the existing lifecycle callbacks. Cover physical deletion through an isolated real API server with no physical log request.

Co-authored-by: Copilot App <[email protected]>

* Unify resource log capture filename generation

Use one filename contract for command and runtime captures, preserve V1 startup filenames and runtime capture suffixes, and capture physical image output with ordinary stdout/stderr source names.

Co-authored-by: Copilot App <[email protected]>

* Complete missing-runtime log sources and focus regression coverage

Finish physical and logical followers after confirmed runtime disappearance, wait for image log-writer release in its assertion, and remove unnecessary simulated image aliases. Cover failed pull diagnostics and stream closure at the production Docker/Podman adapter boundary.

Co-authored-by: Copilot App <[email protected]>

* Protect logical backing lifetimes and settle image inspections

Hold owned physical containers and inline images until logical cleanup permits release. Preserve operation outcomes through status conflicts, clean up dependency-pending startup, and verify uncertain backing creates immediately.

Limit logical startup output to owned images, bound image inspection retries, and align reconciliation and integration tests with repository patterns.

Co-authored-by: Copilot App <[email protected]>

* Align physical resource reconciliation and namespace guards

Move physical resource initialization, state updates, and status projection into management and deletion handlers. Discard completed container and image data alongside finalizer removal, and release resource logs during cleanup.

Replace namespace state-machine stages with a common V2 namespace guard while preserving operation settlement and logical backing holds.

Co-authored-by: Copilot App <[email protected]>

* Make V2 finalizer sequencing explicit

Use an explicit ensureFinalizer call followed by management only when no finalizer change is needed, matching the network controller's control flow without changing deletion guards.

Co-authored-by: Copilot App <[email protected]>

* Simplify V2 reconciliation and logical backing coordination

Separate granular lifecycle states from outstanding asynchronous work. Discover logical backings by owner metadata, require expected children before handoff, and propagate deletion to every owned child.

Preserve cleanup status before releasing finalizers, keep adopted runtimes out of workload ownership records, and retry post-pull image inspection without repeating acquisition.

Co-authored-by: Copilot App <[email protected]>

* Stop existing replacement targets and settle workloads on identity

Acquire and stop the existing named runtime when stop and replace are requested before physical creation. Settle logical workload registration when the physical runtime ID is reported, without waiting for a settled lifecycle phase.

Co-authored-by: Copilot App <[email protected]>

* Release runtime captures through observed log sources

Use a log-source provider capability for primary capture identity and release the observed source UID on deletion, including logical-only log consumers. Preserve existing startup and completion handling.

Co-authored-by: Copilot App <[email protected]>

* Cover bounded volume removal during namespace deletion

Exercise the real API and running controllers with an in-use volume, verifying the grace period, abandonment status, finalizer release, and completion of namespace deletion using existing test infrastructure.

Co-authored-by: Copilot App <[email protected]>

* Remove unused V1 resource streamer adapter

Co-authored-by: Copilot App <[email protected]>

* Append authoritative DCP runtime labels after caller labels

Remove the first-match setter and rely on last-value-wins conversion so duplicate caller labels cannot override system metadata. Cover physical label collisions and persistent logical-container reuse.

Co-authored-by: Copilot App <[email protected]>

* Synchronize log readiness with resource lifecycle processing

Dispatch lifecycle events in per-resource FIFO order and replace request event backlogs with coalesced latest-state notifications. Share a per-resource RW lock across snapshot processing and lifecycle callbacks so deletion cannot overtake requests processing the previous state, while allowing concurrent readers.

Cover latest-state consumption, both deletion/registration orderings, concurrent requests, cross-resource progress, scheduling fairness, and disposal. Preserve existing streamer and finite-copy behavior.

Co-authored-by: Copilot App <[email protected]>

* Requeue image acquisition when exclusive pull leases are held

Acquire pull leases once per operation attempt instead of waiting inside the bounded worker queue. Keep direct pulls and build-base acquisition pending on contention and retry through normal reconciliation without consuming pull retries.

Allow WithResourceLease to forward existing acquisition options so single-attempt calls retain exclusivity and automatic release. Cover same-process contention, unrelated work progress, and recovery after lease release.

Co-authored-by: Copilot App <[email protected]>

* Align V2 lifecycle-key collection ordering with V1

Sort mounts by target, ports by protocol and host port, copied files by destination, and build secrets by ID before hashing the copied configuration. Preserve equal-key declaration order and caller-provided digest behavior.

Cover reordering equivalence, meaningful ordering, input immutability, and persistent runtime reuse after port reordering. Leave acquisition-policy inclusion unchanged.

Co-authored-by: Copilot App <[email protected]>

* Exclude dynamic networks from V2 container lifecycle keys

Match V1 by omitting network attachments and aliases from the copied configuration used for hashing. Preserve the declared spec and avoid making dynamic connection changes trigger persistent container replacement.

Cover membership, ordering, aliases, empty inputs, and immutability; update the intentional V2 golden key and resource plan.

Co-authored-by: Copilot App <[email protected]>

* Separate namespace readiness checks from controller status policy

Return readiness, condition reason, and lookup error from a read-only namespace check. Let all six callers choose their phases, Ready conditions, logging, and reconciliation flags while preserving existing admission behavior.

Document the reduced helper contract and cover initial lookup failure, recovery, and post-initialization stop behavior through the real API/controller environment.

Co-authored-by: Copilot App <[email protected]>

* Clarify logical container backing lookup diagnostic

Use the reviewer's suggested message to describe listing the physical containers backing the logical resource.

Co-authored-by: Copilot App <[email protected]>

* Confirm recorded logical backings are absent before deletion completes

When a physical UID is recorded but the cached owner list is empty, confirm absence through an uncached namespace list filtered by controller-owner UID. Reuse existing container/image deletion loops for discovered children and retry lookup errors without releasing the logical finalizer.

Cover successful creation before cache observation, duplicate owned backings, unrelated resource preservation, and cleanup completion after actual removal. Document the UID-gated confirmation rule.

Co-authored-by: Copilot App <[email protected]>

* Copy finite stdio logs asynchronously

Return a completion channel for non-follow and completed-resource log copies so client backpressure does not hold resource processing locks. Preserve first-EOF behavior without registering lifecycle followers, and let storage cancellation close the response pipe to unblock delivery.

Cover finite-copy formatting, EOF, slow readers, lifecycle progress, request cancellation, and storage disposal.

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: Copilot App <[email protected]>
David Negstad (danegsta) added a commit that referenced this pull request Oct 30, 2026
* Add V2 logical container resource foundation

Introduce logical container and network APIs, delegate logical container lifecycle operations to physical resources, and track persistent workload ownership. Standardize V2 deletion dispatch and terminal startup/stop outcomes with shared API-backed coverage.



* Replace synthetic V2 controller tests with behavioral coverage

Exercise logical readiness through the shared API server and running physical controller using runtime port-mapping fault injection. Remove redundant private deletion-handler tests already covered by retained-resource integration cases.



* Preserve lifecycle duplicate precedence and honor namespace workload IDs

Use stable key sorting for logical container environment, container labels, and build labels. Resolve namespace workload overrides during asynchronous persistent ownership settlement, retaining startup leases on lookup or recording errors and supporting overrides without a global default.



* Import Aspire regression scaffold compatibility fix from #292

Preserve all build directives selected by the daily CLI template instead of requiring an explicit SDK directive. Leave generated AppHost validation to Aspire, supporting package-based templates without importing the unrelated watcher or dependency changes from PR #292.



* Release logical container realization inputs after physical handoff

Make the selected runtime ID explicitly pending and clear it together with the generated session name after physical creation or verification. Project inline image references from the physical creation spec instead of retaining an adopted runtime ID as a marker.



* Capture logical and physical container system diagnostics

Add scoped resource-stream nesting that preserves context, primary bindings, filters, and independent cleanup. Bind V2 container diagnostics by resource UID and forward owned physical container diagnostics to the logical owner's stream, including asynchronous operation failures. Keep resource-file producer names per entry and verify fanout without duplicate process or resource entries. This provides capture and routing only; V2 log subresource registration remains separate.



* Expose namespaced V2 container log endpoints

Share watch-driven log storage and query handling across API versions while preserving V1 contracts. Add logical and physical container stdout, stderr, and system streamers with one physical-UID runtime capture, snapshot-only logical source resolution, independent client lifetimes, namespace preservation, and explicit unsupported-source errors. Project backing physical identity into logical status and exercise actual endpoints, cancellation, and existing V1 log behavior.



* Drive namespace cleanup directly from relational metadata

Replace per-kind cleanup handlers with one uncached list and bounded delete executor, preserving dependency ordering and pending-resource diagnostics.



* Keep V2 container log subresources with their parent types

Declare logical and physical container log subresources alongside their parents, retaining only resource-neutral storage construction and contracts in shared log types.



* Use container-specific filenames for V2 log streaming



* Expose V2 image acquisition logs through shared capture sources

Capture pull and build output, serialize image acquisition with exclusive leases, and project image startup and container runtime sources directly onto logical resources. Preserve the V1 watcher handoff, fix nested resource sink failure reporting, and share CaptureFile between V1 and V2 controllers.



* Rename shared V2 logging package for resource consumers



* Complete logical container log sources when physical backing disappears

Preserve the original physical source identity in a completed, unavailable descriptor so logical-only followers finish through the existing lifecycle callbacks. Cover physical deletion through an isolated real API server with no physical log request.



* Unify resource log capture filename generation

Use one filename contract for command and runtime captures, preserve V1 startup filenames and runtime capture suffixes, and capture physical image output with ordinary stdout/stderr source names.



* Complete missing-runtime log sources and focus regression coverage

Finish physical and logical followers after confirmed runtime disappearance, wait for image log-writer release in its assertion, and remove unnecessary simulated image aliases. Cover failed pull diagnostics and stream closure at the production Docker/Podman adapter boundary.



* Protect logical backing lifetimes and settle image inspections

Hold owned physical containers and inline images until logical cleanup permits release. Preserve operation outcomes through status conflicts, clean up dependency-pending startup, and verify uncertain backing creates immediately.

Limit logical startup output to owned images, bound image inspection retries, and align reconciliation and integration tests with repository patterns.



* Align physical resource reconciliation and namespace guards

Move physical resource initialization, state updates, and status projection into management and deletion handlers. Discard completed container and image data alongside finalizer removal, and release resource logs during cleanup.

Replace namespace state-machine stages with a common V2 namespace guard while preserving operation settlement and logical backing holds.



* Make V2 finalizer sequencing explicit

Use an explicit ensureFinalizer call followed by management only when no finalizer change is needed, matching the network controller's control flow without changing deletion guards.



* Simplify V2 reconciliation and logical backing coordination

Separate granular lifecycle states from outstanding asynchronous work. Discover logical backings by owner metadata, require expected children before handoff, and propagate deletion to every owned child.

Preserve cleanup status before releasing finalizers, keep adopted runtimes out of workload ownership records, and retry post-pull image inspection without repeating acquisition.



* Stop existing replacement targets and settle workloads on identity

Acquire and stop the existing named runtime when stop and replace are requested before physical creation. Settle logical workload registration when the physical runtime ID is reported, without waiting for a settled lifecycle phase.



* Release runtime captures through observed log sources

Use a log-source provider capability for primary capture identity and release the observed source UID on deletion, including logical-only log consumers. Preserve existing startup and completion handling.



* Cover bounded volume removal during namespace deletion

Exercise the real API and running controllers with an in-use volume, verifying the grace period, abandonment status, finalizer release, and completion of namespace deletion using existing test infrastructure.



* Remove unused V1 resource streamer adapter



* Append authoritative DCP runtime labels after caller labels

Remove the first-match setter and rely on last-value-wins conversion so duplicate caller labels cannot override system metadata. Cover physical label collisions and persistent logical-container reuse.



* Synchronize log readiness with resource lifecycle processing

Dispatch lifecycle events in per-resource FIFO order and replace request event backlogs with coalesced latest-state notifications. Share a per-resource RW lock across snapshot processing and lifecycle callbacks so deletion cannot overtake requests processing the previous state, while allowing concurrent readers.

Cover latest-state consumption, both deletion/registration orderings, concurrent requests, cross-resource progress, scheduling fairness, and disposal. Preserve existing streamer and finite-copy behavior.



* Requeue image acquisition when exclusive pull leases are held

Acquire pull leases once per operation attempt instead of waiting inside the bounded worker queue. Keep direct pulls and build-base acquisition pending on contention and retry through normal reconciliation without consuming pull retries.

Allow WithResourceLease to forward existing acquisition options so single-attempt calls retain exclusivity and automatic release. Cover same-process contention, unrelated work progress, and recovery after lease release.



* Align V2 lifecycle-key collection ordering with V1

Sort mounts by target, ports by protocol and host port, copied files by destination, and build secrets by ID before hashing the copied configuration. Preserve equal-key declaration order and caller-provided digest behavior.

Cover reordering equivalence, meaningful ordering, input immutability, and persistent runtime reuse after port reordering. Leave acquisition-policy inclusion unchanged.



* Exclude dynamic networks from V2 container lifecycle keys

Match V1 by omitting network attachments and aliases from the copied configuration used for hashing. Preserve the declared spec and avoid making dynamic connection changes trigger persistent container replacement.

Cover membership, ordering, aliases, empty inputs, and immutability; update the intentional V2 golden key and resource plan.



* Separate namespace readiness checks from controller status policy

Return readiness, condition reason, and lookup error from a read-only namespace check. Let all six callers choose their phases, Ready conditions, logging, and reconciliation flags while preserving existing admission behavior.

Document the reduced helper contract and cover initial lookup failure, recovery, and post-initialization stop behavior through the real API/controller environment.



* Clarify logical container backing lookup diagnostic

Use the reviewer's suggested message to describe listing the physical containers backing the logical resource.



* Confirm recorded logical backings are absent before deletion completes

When a physical UID is recorded but the cached owner list is empty, confirm absence through an uncached namespace list filtered by controller-owner UID. Reuse existing container/image deletion loops for discovered children and retry lookup errors without releasing the logical finalizer.

Cover successful creation before cache observation, duplicate owned backings, unrelated resource preservation, and cleanup completion after actual removal. Document the UID-gated confirmation rule.



* Copy finite stdio logs asynchronously

Return a completion channel for non-follow and completed-resource log copies so client backpressure does not hold resource processing locks. Preserve first-EOF behavior without registering lifecycle followers, and let storage cancellation close the response pipe to unblock delivery.

Cover finite-copy formatting, EOF, slow readers, lifecycle progress, request cancellation, and storage disposal.



---------


(cherry picked from commit 5901d3d)

Co-authored-by: Copilot App <[email protected]>
David Negstad (danegsta) added a commit that referenced this pull request Nov 3, 2026
* Add V2 logical container resource foundation

Introduce logical container and network APIs, delegate logical container lifecycle operations to physical resources, and track persistent workload ownership. Standardize V2 deletion dispatch and terminal startup/stop outcomes with shared API-backed coverage.

Co-authored-by: Copilot App <[email protected]>

* Replace synthetic V2 controller tests with behavioral coverage

Exercise logical readiness through the shared API server and running physical controller using runtime port-mapping fault injection. Remove redundant private deletion-handler tests already covered by retained-resource integration cases.

Co-authored-by: Copilot App <[email protected]>

* Add V2 logical container network lifecycle controller

Delegate runtime network realization to physical resources, manage persistent lifecycle keys and shared leases, and translate logical network attachments for new containers without changing adoption behavior.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve lifecycle duplicate precedence and honor namespace workload IDs

Use stable key sorting for logical container environment, container labels, and build labels. Resolve namespace workload overrides during asynchronous persistent ownership settlement, retaining startup leases on lookup or recording errors and supporting overrides without a global default.

Co-authored-by: Copilot App <[email protected]>

* Honor namespace network ownership and stable label hashing

Resolve workload annotation overrides during persistent network lease settlement, retaining leases on namespace lookup failures, and preserve duplicate label precedence in lifecycle keys.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Import Aspire regression scaffold compatibility fix from #292

Preserve all build directives selected by the daily CLI template instead of requiring an explicit SDK directive. Leave generated AppHost validation to Aspire, supporting package-based templates without importing the unrelated watcher or dependency changes from PR #292.

Co-authored-by: Copilot App <[email protected]>

* Release logical container realization inputs after physical handoff

Make the selected runtime ID explicitly pending and clear it together with the generated session name after physical creation or verification. Project inline image references from the physical creation spec instead of retaining an adopted runtime ID as a marker.

Co-authored-by: Copilot App <[email protected]>

* Limit selected network identity to physical handoff

Retain the runtime ID only as a pending adoption input and clear it once the physical resource owns the selected identity.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Use shared integration setup for network workload ownership

Replace per-controller ownership permutations and private environments with one persisted-ownership scenario in the shared real API/controller environment.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Prepare images before network readiness and consume published backing refs

Use logical network readiness and its published physical reference instead of duplicating physical lookups. Create inline image resources before waiting for networks so image preparation can proceed independently.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Focus logical network tests on logical controller contracts

Use shared setup for scoped lifecycle and ownership scenarios, consolidate deletion ordering coverage, move duplicate-label sorting regression to API tests, and remove unrelated cancellation and runtime retry checks.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Capture logical and physical container system diagnostics

Add scoped resource-stream nesting that preserves context, primary bindings, filters, and independent cleanup. Bind V2 container diagnostics by resource UID and forward owned physical container diagnostics to the logical owner's stream, including asynchronous operation failures. Keep resource-file producer names per entry and verify fanout without duplicate process or resource entries. This provides capture and routing only; V2 log subresource registration remains separate.

Co-authored-by: Copilot App <[email protected]>

* Expose namespaced V2 container log endpoints

Share watch-driven log storage and query handling across API versions while preserving V1 contracts. Add logical and physical container stdout, stderr, and system streamers with one physical-UID runtime capture, snapshot-only logical source resolution, independent client lifetimes, namespace preservation, and explicit unsupported-source errors. Project backing physical identity into logical status and exercise actual endpoints, cancellation, and existing V1 log behavior.

Co-authored-by: Copilot App <[email protected]>

* Drive namespace cleanup directly from relational metadata

Replace per-kind cleanup handlers with one uncached list and bounded delete executor, preserving dependency ordering and pending-resource diagnostics.

Co-authored-by: Copilot App <[email protected]>

* Keep V2 container log subresources with their parent types

Declare logical and physical container log subresources alongside their parents, retaining only resource-neutral storage construction and contracts in shared log types.

Co-authored-by: Copilot App <[email protected]>

* Use container-specific filenames for V2 log streaming

Co-authored-by: Copilot App <[email protected]>

* Expose V2 image acquisition logs through shared capture sources

Capture pull and build output, serialize image acquisition with exclusive leases, and project image startup and container runtime sources directly onto logical resources. Preserve the V1 watcher handoff, fix nested resource sink failure reporting, and share CaptureFile between V1 and V2 controllers.

Co-authored-by: Copilot App <[email protected]>

* Rename shared V2 logging package for resource consumers

Co-authored-by: Copilot App <[email protected]>

* Expose logical and physical network system logs

Capture UID-scoped network diagnostics and forward physical messages to their immediate logical owner. Register namespaced system-only endpoints using the shared V2 streamer, preserving existing lifecycle handoff and independent followers.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Complete logical container log sources when physical backing disappears

Preserve the original physical source identity in a completed, unavailable descriptor so logical-only followers finish through the existing lifecycle callbacks. Cover physical deletion through an isolated real API server with no physical log request.

Co-authored-by: Copilot App <[email protected]>

* Unify resource log capture filename generation

Use one filename contract for command and runtime captures, preserve V1 startup filenames and runtime capture suffixes, and capture physical image output with ordinary stdout/stderr source names.

Co-authored-by: Copilot App <[email protected]>

* Serialize persistent network startups within the same process

Acquire exclusive runtime-name leases so one logical network cannot release another startup's claim. Exercise two same-owner logical networks in the shared real API/controller environment and verify reuse after settlement.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Complete missing-runtime log sources and focus regression coverage

Finish physical and logical followers after confirmed runtime disappearance, wait for image log-writer release in its assertion, and remove unnecessary simulated image aliases. Cover failed pull diagnostics and stream closure at the production Docker/Podman adapter boundary.

Co-authored-by: Copilot App <[email protected]>

* Correct logical network ownership settlement and startup failure propagation

Use operation-local ownership candidates from verified physical observations, settle retained startup before child deletion, and release canceled pre-handoff leases without runtime-name ownership discovery. Preserve namespace cleanup when termination prevents physical startup, including a committed Create with a lost response.

Surface terminal image failure while logical network dependencies remain unavailable and keep startup failure latched after dependency recovery.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Make DCP runtime labels override duplicate caller values

Update every matching label entry in the shared setter while preserving unrelated labels and their ordering. Cover reserved ownership labels, caller immutability, and persistent-network reuse with duplicate lifecycle labels.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Require exclusive V1 persistent network creation leases

Forward lease options through WithResourceLease and opt V1 network creation into same-process exclusivity. Keep release within the callback scope instead of issuing redundant status-driven releases that can remove a later startup's lease.

Cover wrapper exclusivity and real-API V1/V2 creation serialization, shared runtime references, and retained workload registration.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Stop scheduled retries for confirmed missing runtime networks

Match the physical-container Unknown/missing projection without periodic requeue. Preserve event-driven observation of the pinned runtime ID and retry transient inspection failures.

Cover retry-policy parity, retained identity and details, same-name replacement isolation, and deletion without removing the replacement.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Match parent deletion ordering for missing runtime networks

For a current-generation confirmed-missing runtime observation, delete the verified owned physical backing and settle the creation lease without an ownership candidate after its disappearance. Preserve normal runtime observation and retain retries for inspection failures.

Cover runtime removal before and during logical deletion while namespace workload lookup remains unavailable, with no persistent record and successful namespace cleanup.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Protect logical backing lifetimes and settle image inspections

Hold owned physical containers and inline images until logical cleanup permits release. Preserve operation outcomes through status conflicts, clean up dependency-pending startup, and verify uncertain backing creates immediately.

Limit logical startup output to owned images, bound image inspection retries, and align reconciliation and integration tests with repository patterns.

Co-authored-by: Copilot App <[email protected]>

* Hold physical networks until their logical owner authorizes deletion

Initialize logical and physical finalizers atomically, continue physical observation while held, and release the logical hold only after stable current-generation outcomes and required ownership settlement. Preserve release authorization across lost responses and treat unauthorized backing loss as terminal.

Align logical network deletion bookkeeping and data lifetime with the parent container protocol. Permit held deleting network dependencies and cover durable status, independent finalizers, uncertain release, finalizer conflicts, early deletion, and protocol violations through the real API.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align physical resource reconciliation and namespace guards

Move physical resource initialization, state updates, and status projection into management and deletion handlers. Discard completed container and image data alongside finalizer removal, and release resource logs during cleanup.

Replace namespace state-machine stages with a common V2 namespace guard while preserving operation settlement and logical backing holds.

Co-authored-by: Copilot App <[email protected]>

* Align logical network handoff cleanup with containers

Remove redundant stale-UID state recovery and clear the generated runtime name after verified physical handoff. Keep pre-handoff inputs intact for uncertain-Create deletion verification.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Make V2 finalizer sequencing explicit

Use an explicit ensureFinalizer call followed by management only when no finalizer change is needed, matching the network controller's control flow without changing deletion guards.

Co-authored-by: Copilot App <[email protected]>

* Make logical network finalizer sequencing explicit

Preserve the compound deletion and operation guard while separating finalizer updates from management, matching the parent V2 controller pattern.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Simplify V2 reconciliation and logical backing coordination

Separate granular lifecycle states from outstanding asynchronous work. Discover logical backings by owner metadata, require expected children before handoff, and propagate deletion to every owned child.

Preserve cleanup status before releasing finalizers, keep adopted runtimes out of workload ownership records, and retry post-pull image inspection without repeating acquisition.

Co-authored-by: Copilot App <[email protected]>

* Stop existing replacement targets and settle workloads on identity

Acquire and stop the existing named runtime when stop and replace are requested before physical creation. Settle logical workload registration when the physical runtime ID is reported, without waiting for a settled lifecycle phase.

Co-authored-by: Copilot App <[email protected]>

* Release runtime captures through observed log sources

Use a log-source provider capability for primary capture identity and release the observed source UID on deletion, including logical-only log consumers. Preserve existing startup and completion handling.

Co-authored-by: Copilot App <[email protected]>

* Cover bounded volume removal during namespace deletion

Exercise the real API and running controllers with an in-use volume, verifying the grace period, abandonment status, finalizer release, and completion of namespace deletion using existing test infrastructure.

Co-authored-by: Copilot App <[email protected]>

* Remove unused V1 resource streamer adapter

Co-authored-by: Copilot App <[email protected]>

* Append authoritative DCP runtime labels after caller labels

Remove the first-match setter and rely on last-value-wins conversion so duplicate caller labels cannot override system metadata. Cover physical label collisions and persistent logical-container reuse.

Co-authored-by: Copilot App <[email protected]>

* Synchronize log readiness with resource lifecycle processing

Dispatch lifecycle events in per-resource FIFO order and replace request event backlogs with coalesced latest-state notifications. Share a per-resource RW lock across snapshot processing and lifecycle callbacks so deletion cannot overtake requests processing the previous state, while allowing concurrent readers.

Cover latest-state consumption, both deletion/registration orderings, concurrent requests, cross-resource progress, scheduling fairness, and disposal. Preserve existing streamer and finite-copy behavior.

Co-authored-by: Copilot App <[email protected]>

* Requeue image acquisition when exclusive pull leases are held

Acquire pull leases once per operation attempt instead of waiting inside the bounded worker queue. Keep direct pulls and build-base acquisition pending on contention and retry through normal reconciliation without consuming pull retries.

Allow WithResourceLease to forward existing acquisition options so single-attempt calls retain exclusivity and automatic release. Cover same-process contention, unrelated work progress, and recovery after lease release.

Co-authored-by: Copilot App <[email protected]>

* Align V2 lifecycle-key collection ordering with V1

Sort mounts by target, ports by protocol and host port, copied files by destination, and build secrets by ID before hashing the copied configuration. Preserve equal-key declaration order and caller-provided digest behavior.

Cover reordering equivalence, meaningful ordering, input immutability, and persistent runtime reuse after port reordering. Leave acquisition-policy inclusion unchanged.

Co-authored-by: Copilot App <[email protected]>

* Exclude dynamic networks from V2 container lifecycle keys

Match V1 by omitting network attachments and aliases from the copied configuration used for hashing. Preserve the declared spec and avoid making dynamic connection changes trigger persistent container replacement.

Cover membership, ordering, aliases, empty inputs, and immutability; update the intentional V2 golden key and resource plan.

Co-authored-by: Copilot App <[email protected]>

* Separate namespace readiness checks from controller status policy

Return readiness, condition reason, and lookup error from a read-only namespace check. Let all six callers choose their phases, Ready conditions, logging, and reconciliation flags while preserving existing admission behavior.

Document the reduced helper contract and cover initial lookup failure, recovery, and post-initialization stop behavior through the real API/controller environment.

Co-authored-by: Copilot App <[email protected]>

* Clarify logical container backing lookup diagnostic

Use the reviewer's suggested message to describe listing the physical containers backing the logical resource.

Co-authored-by: Copilot App <[email protected]>

* Confirm recorded logical backings are absent before deletion completes

When a physical UID is recorded but the cached owner list is empty, confirm absence through an uncached namespace list filtered by controller-owner UID. Reuse existing container/image deletion loops for discovered children and retry lookup errors without releasing the logical finalizer.

Cover successful creation before cache observation, duplicate owned backings, unrelated resource preservation, and cleanup completion after actual removal. Document the UID-gated confirmation rule.

Co-authored-by: Copilot App <[email protected]>

* Copy finite stdio logs asynchronously

Return a completion channel for non-follow and completed-resource log copies so client backpressure does not hold resource processing locks. Preserve first-EOF behavior without registering lifecycle followers, and let storage cancellation close the response pipe to unblock delivery.

Cover finite-copy formatting, EOF, slow readers, lifecycle progress, request cancellation, and storage disposal.

Co-authored-by: Copilot App <[email protected]>

* Resolve network declarations without duplicating physical dependency gates

Use a published physical network reference without requiring logical readiness, while rejecting terminal logical network failure and settling the creation lease. Remove extra image observation and failure handling from Pending; retain the parent's inline-image declaration and log projection unchanged.

Verify physical-container declaration while network startup is blocked, physical-owned image failure propagation after references resolve, terminal network rejection, and unchanged adopted attachments. Update the published API reference contract and generated OpenAPI documentation.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Separate logical network reconciliation steps with whitespace

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align logical network running handler naming with containers

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align logical network state transitions with logical containers

Rely on child observation after successful preparation, avoid follow-up retries for terminal duplicate discovery, and consume physical Ready with a true Ready condition without redundant identity or generation gates. Preserve accumulated lease-settlement changes during handoff.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Colocate controller state strings with their enum definitions

Move all seven existing String methods unchanged into the respective controller data files and remove the centralized state-string file. Keep shared diagnostic tests in place.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Fail container startup on terminal dependency failures

Treat failed network and volume references like failed image references, preserving dependency diagnostics and releasing unused startup leases without resuming after replacement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Evaluate all container dependencies with shared lifecycle states

Prevent pending prerequisites from hiding later failures or required retries. Share dependency preparation states and condition reasons across resource kinds while retaining dependency diagnostics, terminal latching, and lease settlement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Match V1 network harvest protection and retry behavior

Inspect runtime networks even when startup-harvest protection is contended, and wait only before reusing a found network. Allow missing persistent networks to be created during harvesting and use ordinary short retries for reuse contention without adding retry-delay state.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Verify logical backing absence by owner before finalizing deletion

Confirm every empty cached owner list through the uncached reader, including after committed Creates whose response did not provide a backing UID. Cover unrecorded network, container, and image backings, confirmation failures, cleanup, and unrelated-resource preservation through running controllers.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve terminal dependency failure before replacement stop

Keep ended startup attempts from resolving and claiming replacement targets after stop is requested. Cover existing and missing runtime targets while retaining nonterminal replacement-stop behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Keep owned startup logs current after preparation failure

Continue observing and projecting existing inline image acquisition logs while logical container preparation is terminal. Preserve independent dependency work and lease settlement without reordering declarations or restarting startup.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve adopted network lifecycle keys across uncertain handoff

Retain selected lifecycle identity independently of a decoded physical backing UID, following the parent logical container pattern. Cover failed confirmation and later owner discovery without adding runtime recovery or changing lease settlement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Clarify container network and physical resource terminology

Name backing container networks directly in comments, diagnostics, documentation, and local identifiers. Reserve physical wording for V2 API resources and retain public identifiers and genuine container-engine references.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

---------

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2
David Negstad (danegsta) added a commit that referenced this pull request Nov 4, 2026
* Add V2 logical container resource foundation

Introduce logical container and network APIs, delegate logical container lifecycle operations to physical resources, and track persistent workload ownership. Standardize V2 deletion dispatch and terminal startup/stop outcomes with shared API-backed coverage.

Co-authored-by: Copilot App <[email protected]>

* Replace synthetic V2 controller tests with behavioral coverage

Exercise logical readiness through the shared API server and running physical controller using runtime port-mapping fault injection. Remove redundant private deletion-handler tests already covered by retained-resource integration cases.

Co-authored-by: Copilot App <[email protected]>

* Add V2 logical container network lifecycle controller

Delegate runtime network realization to physical resources, manage persistent lifecycle keys and shared leases, and translate logical network attachments for new containers without changing adoption behavior.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve lifecycle duplicate precedence and honor namespace workload IDs

Use stable key sorting for logical container environment, container labels, and build labels. Resolve namespace workload overrides during asynchronous persistent ownership settlement, retaining startup leases on lookup or recording errors and supporting overrides without a global default.

Co-authored-by: Copilot App <[email protected]>

* Honor namespace network ownership and stable label hashing

Resolve workload annotation overrides during persistent network lease settlement, retaining leases on namespace lookup failures, and preserve duplicate label precedence in lifecycle keys.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Import Aspire regression scaffold compatibility fix from #292

Preserve all build directives selected by the daily CLI template instead of requiring an explicit SDK directive. Leave generated AppHost validation to Aspire, supporting package-based templates without importing the unrelated watcher or dependency changes from PR #292.

Co-authored-by: Copilot App <[email protected]>

* Release logical container realization inputs after physical handoff

Make the selected runtime ID explicitly pending and clear it together with the generated session name after physical creation or verification. Project inline image references from the physical creation spec instead of retaining an adopted runtime ID as a marker.

Co-authored-by: Copilot App <[email protected]>

* Limit selected network identity to physical handoff

Retain the runtime ID only as a pending adoption input and clear it once the physical resource owns the selected identity.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Use shared integration setup for network workload ownership

Replace per-controller ownership permutations and private environments with one persisted-ownership scenario in the shared real API/controller environment.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Prepare images before network readiness and consume published backing refs

Use logical network readiness and its published physical reference instead of duplicating physical lookups. Create inline image resources before waiting for networks so image preparation can proceed independently.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Focus logical network tests on logical controller contracts

Use shared setup for scoped lifecycle and ownership scenarios, consolidate deletion ordering coverage, move duplicate-label sorting regression to API tests, and remove unrelated cancellation and runtime retry checks.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Add V2 logical process lifecycle management

Delegate process execution to identity-bound physical resources, with session, persistent, and existing lifecycle modes. Record retained process ownership before releasing startup leases, including deletion during launch. Treat process launch errors as terminal.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Capture logical and physical container system diagnostics

Add scoped resource-stream nesting that preserves context, primary bindings, filters, and independent cleanup. Bind V2 container diagnostics by resource UID and forward owned physical container diagnostics to the logical owner's stream, including asynchronous operation failures. Keep resource-file producer names per entry and verify fanout without duplicate process or resource entries. This provides capture and routing only; V2 log subresource registration remains separate.

Co-authored-by: Copilot App <[email protected]>

* Settle logical process persistence before physical deletion

Keep startup settlement and ownership recording in the logical controller before requesting physical deletion. Remove the startup finalizer handshake, deletion-time physical status projection, and the guard introduced to support them.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Expose namespaced V2 container log endpoints

Share watch-driven log storage and query handling across API versions while preserving V1 contracts. Add logical and physical container stdout, stderr, and system streamers with one physical-UID runtime capture, snapshot-only logical source resolution, independent client lifetimes, namespace preservation, and explicit unsupported-source errors. Project backing physical identity into logical status and exercise actual endpoints, cancellation, and existing V1 log behavior.

Co-authored-by: Copilot App <[email protected]>

* Drive namespace cleanup directly from relational metadata

Replace per-kind cleanup handlers with one uncached list and bounded delete executor, preserving dependency ordering and pending-resource diagnostics.

Co-authored-by: Copilot App <[email protected]>

* Keep V2 container log subresources with their parent types

Declare logical and physical container log subresources alongside their parents, retaining only resource-neutral storage construction and contracts in shared log types.

Co-authored-by: Copilot App <[email protected]>

* Use container-specific filenames for V2 log streaming

Co-authored-by: Copilot App <[email protected]>

* Expose V2 image acquisition logs through shared capture sources

Capture pull and build output, serialize image acquisition with exclusive leases, and project image startup and container runtime sources directly onto logical resources. Preserve the V1 watcher handoff, fix nested resource sink failure reporting, and share CaptureFile between V1 and V2 controllers.

Co-authored-by: Copilot App <[email protected]>

* Rename shared V2 logging package for resource consumers

Co-authored-by: Copilot App <[email protected]>

* Expose logical and physical network system logs

Capture UID-scoped network diagnostics and forward physical messages to their immediate logical owner. Register namespaced system-only endpoints using the shared V2 streamer, preserving existing lifecycle handoff and independent followers.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Add logical and physical process log streaming

Capture process output in the physical controller and publish immediate physical log-source snapshots through logical status. Reuse shared V2 streaming and owner-scoped system diagnostics, with direct file redirection for retained processes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Complete logical container log sources when physical backing disappears

Preserve the original physical source identity in a completed, unavailable descriptor so logical-only followers finish through the existing lifecycle callbacks. Cover physical deletion through an isolated real API server with no physical log request.

Co-authored-by: Copilot App <[email protected]>

* Unify resource log capture filename generation

Use one filename contract for command and runtime captures, preserve V1 startup filenames and runtime capture suffixes, and capture physical image output with ordinary stdout/stderr source names.

Co-authored-by: Copilot App <[email protected]>

* Complete logical process logs when physical backing disappears

Project stable completed log-source identity on every missing-backing reconciliation, including persistence settlement, so logical-only followers finish and status-write conflicts cannot lose completion.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Recover physical processes before forwarding logical stop

Inspect and adopt a matching owned physical process before rechecking creation prerequisites. Exclude mutable stop from immutable configuration comparison and forward it through runtime reconciliation. Cover lost successful-create responses in session and persistent modes through the real API.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Serialize persistent network startups within the same process

Acquire exclusive runtime-name leases so one logical network cannot release another startup's claim. Exercise two same-owner logical networks in the shared real API/controller environment and verify reuse after settlement.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Complete missing-runtime log sources and focus regression coverage

Finish physical and logical followers after confirmed runtime disappearance, wait for image log-writer release in its assertion, and remove unnecessary simulated image aliases. Cover failed pull diagnostics and stream closure at the production Docker/Podman adapter boundary.

Co-authored-by: Copilot App <[email protected]>

* Fix process persistence and output lifecycle review findings

Isolate process lease keys, preserve runtime stop handling during persistence settlement, and select raw capture reader settings. Publish output completion after pipe drainage and retry capture disposal through existing cleanup helpers and reconciliation. Add focused regressions and remove the cleanup test's file-restoration race.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Fail logical processes when physical backing disappears

Treat loss of handed-off physical backing as terminal, preserve completed log-source identity, and release startup leases without recreating resources or reconstructing runtime ownership. Cover startup and ownership-recording loss, status conflicts, and namespace deletion.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Correct logical network ownership settlement and startup failure propagation

Use operation-local ownership candidates from verified physical observations, settle retained startup before child deletion, and release canceled pre-handoff leases without runtime-name ownership discovery. Preserve namespace cleanup when termination prevents physical startup, including a committed Create with a lost response.

Surface terminal image failure while logical network dependencies remain unavailable and keep startup failure latched after dependency recovery.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Make DCP runtime labels override duplicate caller values

Update every matching label entry in the shared setter while preserving unrelated labels and their ordering. Cover reserved ownership labels, caller immutability, and persistent-network reuse with duplicate lifecycle labels.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Require exclusive V1 persistent network creation leases

Forward lease options through WithResourceLease and opt V1 network creation into same-process exclusivity. Keep release within the callback scope instead of issuing redundant status-driven releases that can remove a later startup's lease.

Cover wrapper exclusivity and real-API V1/V2 creation serialization, shared runtime references, and retained workload registration.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Stop scheduled retries for confirmed missing runtime networks

Match the physical-container Unknown/missing projection without periodic requeue. Preserve event-driven observation of the pinned runtime ID and retry transient inspection failures.

Cover retry-policy parity, retained identity and details, same-name replacement isolation, and deletion without removing the replacement.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Match parent deletion ordering for missing runtime networks

For a current-generation confirmed-missing runtime observation, delete the verified owned physical backing and settle the creation lease without an ownership candidate after its disappearance. Preserve normal runtime observation and retain retries for inspection failures.

Cover runtime removal before and during logical deletion while namespace workload lookup remains unavailable, with no persistent record and successful namespace cleanup.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Protect logical backing lifetimes and settle image inspections

Hold owned physical containers and inline images until logical cleanup permits release. Preserve operation outcomes through status conflicts, clean up dependency-pending startup, and verify uncertain backing creates immediately.

Limit logical startup output to owned images, bound image inspection retries, and align reconciliation and integration tests with repository patterns.

Co-authored-by: Copilot App <[email protected]>

* Hold physical networks until their logical owner authorizes deletion

Initialize logical and physical finalizers atomically, continue physical observation while held, and release the logical hold only after stable current-generation outcomes and required ownership settlement. Preserve release authorization across lost responses and treat unauthorized backing loss as terminal.

Align logical network deletion bookkeeping and data lifetime with the parent container protocol. Permit held deleting network dependencies and cover durable status, independent finalizers, uncertain release, finalizer conflicts, early deletion, and protocol violations through the real API.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align physical resource reconciliation and namespace guards

Move physical resource initialization, state updates, and status projection into management and deletion handlers. Discard completed container and image data alongside finalizer removal, and release resource logs during cleanup.

Replace namespace state-machine stages with a common V2 namespace guard while preserving operation settlement and logical backing holds.

Co-authored-by: Copilot App <[email protected]>

* Align logical network handoff cleanup with containers

Remove redundant stale-UID state recovery and clear the generated runtime name after verified physical handoff. Keep pre-handoff inputs intact for uncertain-Create deletion verification.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Make V2 finalizer sequencing explicit

Use an explicit ensureFinalizer call followed by management only when no finalizer change is needed, matching the network controller's control flow without changing deletion guards.

Co-authored-by: Copilot App <[email protected]>

* Make logical network finalizer sequencing explicit

Preserve the compound deletion and operation guard while separating finalizer updates from management, matching the parent V2 controller pattern.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Use shared namespace guard for logical process prerequisites

Adapt logical process initialization and physical creation checks to the updated parent namespace guard without restoring the removed helper.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Simplify V2 reconciliation and logical backing coordination

Separate granular lifecycle states from outstanding asynchronous work. Discover logical backings by owner metadata, require expected children before handoff, and propagate deletion to every owned child.

Preserve cleanup status before releasing finalizers, keep adopted runtimes out of workload ownership records, and retry post-pull image inspection without repeating acquisition.

Co-authored-by: Copilot App <[email protected]>

* Stop existing replacement targets and settle workloads on identity

Acquire and stop the existing named runtime when stop and replace are requested before physical creation. Settle logical workload registration when the physical runtime ID is reported, without waiting for a settled lifecycle phase.

Co-authored-by: Copilot App <[email protected]>

* Release runtime captures through observed log sources

Use a log-source provider capability for primary capture identity and release the observed source UID on deletion, including logical-only log consumers. Preserve existing startup and completion handling.

Co-authored-by: Copilot App <[email protected]>

* Cover bounded volume removal during namespace deletion

Exercise the real API and running controllers with an in-use volume, verifying the grace period, abandonment status, finalizer release, and completion of namespace deletion using existing test infrastructure.

Co-authored-by: Copilot App <[email protected]>

* Remove unused V1 resource streamer adapter

Co-authored-by: Copilot App <[email protected]>

* Append authoritative DCP runtime labels after caller labels

Remove the first-match setter and rely on last-value-wins conversion so duplicate caller labels cannot override system metadata. Cover physical label collisions and persistent logical-container reuse.

Co-authored-by: Copilot App <[email protected]>

* Synchronize log readiness with resource lifecycle processing

Dispatch lifecycle events in per-resource FIFO order and replace request event backlogs with coalesced latest-state notifications. Share a per-resource RW lock across snapshot processing and lifecycle callbacks so deletion cannot overtake requests processing the previous state, while allowing concurrent readers.

Cover latest-state consumption, both deletion/registration orderings, concurrent requests, cross-resource progress, scheduling fairness, and disposal. Preserve existing streamer and finite-copy behavior.

Co-authored-by: Copilot App <[email protected]>

* Requeue image acquisition when exclusive pull leases are held

Acquire pull leases once per operation attempt instead of waiting inside the bounded worker queue. Keep direct pulls and build-base acquisition pending on contention and retry through normal reconciliation without consuming pull retries.

Allow WithResourceLease to forward existing acquisition options so single-attempt calls retain exclusivity and automatic release. Cover same-process contention, unrelated work progress, and recovery after lease release.

Co-authored-by: Copilot App <[email protected]>

* Align V2 lifecycle-key collection ordering with V1

Sort mounts by target, ports by protocol and host port, copied files by destination, and build secrets by ID before hashing the copied configuration. Preserve equal-key declaration order and caller-provided digest behavior.

Cover reordering equivalence, meaningful ordering, input immutability, and persistent runtime reuse after port reordering. Leave acquisition-policy inclusion unchanged.

Co-authored-by: Copilot App <[email protected]>

* Exclude dynamic networks from V2 container lifecycle keys

Match V1 by omitting network attachments and aliases from the copied configuration used for hashing. Preserve the declared spec and avoid making dynamic connection changes trigger persistent container replacement.

Cover membership, ordering, aliases, empty inputs, and immutability; update the intentional V2 golden key and resource plan.

Co-authored-by: Copilot App <[email protected]>

* Separate namespace readiness checks from controller status policy

Return readiness, condition reason, and lookup error from a read-only namespace check. Let all six callers choose their phases, Ready conditions, logging, and reconciliation flags while preserving existing admission behavior.

Document the reduced helper contract and cover initial lookup failure, recovery, and post-initialization stop behavior through the real API/controller environment.

Co-authored-by: Copilot App <[email protected]>

* Clarify logical container backing lookup diagnostic

Use the reviewer's suggested message to describe listing the physical containers backing the logical resource.

Co-authored-by: Copilot App <[email protected]>

* Confirm recorded logical backings are absent before deletion completes

When a physical UID is recorded but the cached owner list is empty, confirm absence through an uncached namespace list filtered by controller-owner UID. Reuse existing container/image deletion loops for discovered children and retry lookup errors without releasing the logical finalizer.

Cover successful creation before cache observation, duplicate owned backings, unrelated resource preservation, and cleanup completion after actual removal. Document the UID-gated confirmation rule.

Co-authored-by: Copilot App <[email protected]>

* Copy finite stdio logs asynchronously

Return a completion channel for non-follow and completed-resource log copies so client backpressure does not hold resource processing locks. Preserve first-EOF behavior without registering lifecycle followers, and let storage cancellation close the response pipe to unblock delivery.

Cover finite-copy formatting, EOF, slow readers, lifecycle progress, request cancellation, and storage disposal.

Co-authored-by: Copilot App <[email protected]>

* Resolve network declarations without duplicating physical dependency gates

Use a published physical network reference without requiring logical readiness, while rejecting terminal logical network failure and settling the creation lease. Remove extra image observation and failure handling from Pending; retain the parent's inline-image declaration and log projection unchanged.

Verify physical-container declaration while network startup is blocked, physical-owned image failure propagation after references resolve, terminal network rejection, and unchanged adopted attachments. Update the published API reference contract and generated OpenAPI documentation.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Separate logical network reconciliation steps with whitespace

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align logical network running handler naming with containers

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align logical network state transitions with logical containers

Rely on child observation after successful preparation, avoid follow-up retries for terminal duplicate discovery, and consume physical Ready with a true Ready condition without redundant identity or generation gates. Preserve accumulated lease-settlement changes during handoff.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Colocate controller state strings with their enum definitions

Move all seven existing String methods unchanged into the respective controller data files and remove the centralized state-string file. Keep shared diagnostic tests in place.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Fail container startup on terminal dependency failures

Treat failed network and volume references like failed image references, preserving dependency diagnostics and releasing unused startup leases without resuming after replacement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Evaluate all container dependencies with shared lifecycle states

Prevent pending prerequisites from hiding later failures or required retries. Share dependency preparation states and condition reasons across resource kinds while retaining dependency diagnostics, terminal latching, and lease settlement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve and reuse retained process output files

Store process capture paths for persistent reuse and pass optional output files to identity-bound physical PID references. Remove recorded captures when replacing or cleaning up exited V2 processes while preserving V1 startup cleanup behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Align logical process state management with parent controllers

Coordinate lifecycle preparation and persistence directly during reconciliation, admit namespaces before initializing state, and preserve lifecycle states across retry diagnostics. Remove logical asynchronous operation machinery and cover backing observation recovery and deletion before namespace admission.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Match V1 network harvest protection and retry behavior

Inspect runtime networks even when startup-harvest protection is contended, and wait only before reusing a found network. Allow missing persistent networks to be created during harvesting and use ordinary short retries for reuse contention without adding retry-delay state.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Verify logical backing absence by owner before finalizing deletion

Confirm every empty cached owner list through the uncached reader, including after committed Creates whose response did not provide a backing UID. Cover unrecorded network, container, and image backings, confirmation failures, cleanup, and unrelated-resource preservation through running controllers.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve terminal dependency failure before replacement stop

Keep ended startup attempts from resolving and claiming replacement targets after stop is requested. Cover existing and missing runtime targets while retaining nonterminal replacement-stop behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Keep owned startup logs current after preparation failure

Continue observing and projecting existing inline image acquisition logs while logical container preparation is terminal. Preserve independent dependency work and lease settlement without reordering declarations or restarting startup.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve adopted network lifecycle keys across uncertain handoff

Retain selected lifecycle identity independently of a decoded physical backing UID, following the parent logical container pattern. Cover failed confirmation and later owner discovery without adding runtime recovery or changing lease settlement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Clarify container network and physical resource terminology

Name backing container networks directly in comments, diagnostics, documentation, and local identifiers. Reserve physical wording for V2 API resources and retain public identifiers and genuine container-engine references.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Isolate retained launch gates and parallelize deletion tests

Gate retained process startup through per-test executor decoration outside the shared executor mutex. Run deletion cases in parallel and verify an unrelated process can launch while the retained launch is paused.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Align process backing lifetime with shared logical holds

Create physical backings with both cleanup finalizers, request deletion before persistence settlement, and retain backing observations until workload registration and startup lease release finish. Confirm missing primary or replacement backings uncached and preserve terminal handling of unauthorized backing loss.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Normalize process lifecycle keys using effective environment values

Encode selected process fields individually and normalize explicit environment declarations with platform-aware last-value-wins semantics. Preserve inheritance defaults, explicit keys and V1 hashing, with differential environment-equivalence coverage.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Preserve retained process capture across session cleanup

Share V1's persistent process output directory with retained V2 captures, and honor executable log preservation when disposing created process output. Cover session cleanup followed by adoption, preserved session and persistent output, and unchanged directory configuration/elevation behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Increase default Go package test timeout to twenty minutes

Set the shared local/CI test timeout explicitly and keep the Windows CI driver aligned without changing per-test contexts or parallelism.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Project process output completion while logical deletion waits

Continue projecting the verified physical backing snapshot during cleanup so logical-only followers can drain and release capture readers. Preserve completion changes across deletion returns and cover namespace deletion without starting a physical log watch.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Preserve workload ownership during unscoped process reuse

Only replace an existing process workload association when the resolved workload ID is nonempty. Cover scoped-to-unscoped reuse and ownerless replacement in the existing integration regression.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Clarify process and backing resource terminology

Distinguish operating system processes from PhysicalProcess API resources in comments, documentation, and generated schema descriptions. No behavioral or public identifier changes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Use ambient environment behavior in V2 process APIs

Replace the inheritance boolean with V2-owned ambientEnvironment.behavior in both logical and physical process configurations. Preserve inheritance defaults, explicit environment precedence, and published lifecycle keys; validate supported behaviors and keep the generated API artifacts in sync.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Restore best-effort process output cleanup and address review feedback

Cache bounded capture disposal with OnceValue and log output-removal failures without blocking process finalization, replacement, or retirement of confirmed-gone records. Update cleanup regressions and documentation, share the process key prefix, clarify log-stream completion and raw filtering, and distinguish missing process data from the API object.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Queue V2 output cleanup outside reconciliation

Share a host-lifetime bounded cleanup queue across process and image reconcilers. Preserve capture-drain ordering and best-effort disposal, reuse CloseAndLog, and keep file removal independent of resource finalization and process operations. Cover blocked cleanup through the real API, await asynchronous removal in existing tests, and consolidate overlapping serial log coverage.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Clarify process capture cleanup and identity contracts

Document best-effort capture removal on resource deletion after process exit or confirmed absence, including PID reuse. Clarify the identity timestamp's use for subsequent persistent-process PID-reuse protection and retain the Linux since-boot distinction.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Align log deletion test with best-effort capture cleanup

Keep follower completion and recreated-capture isolation checks without waiting for guaranteed file removal with open Windows readers. Clean up leftover captures in test teardown after the followers close.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

---------

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9
David Negstad (danegsta) added a commit that referenced this pull request Nov 5, 2026
* Add V2 logical container resource foundation

Introduce logical container and network APIs, delegate logical container lifecycle operations to physical resources, and track persistent workload ownership. Standardize V2 deletion dispatch and terminal startup/stop outcomes with shared API-backed coverage.

Co-authored-by: Copilot App <[email protected]>

* Replace synthetic V2 controller tests with behavioral coverage

Exercise logical readiness through the shared API server and running physical controller using runtime port-mapping fault injection. Remove redundant private deletion-handler tests already covered by retained-resource integration cases.

Co-authored-by: Copilot App <[email protected]>

* Add V2 logical container network lifecycle controller

Delegate runtime network realization to physical resources, manage persistent lifecycle keys and shared leases, and translate logical network attachments for new containers without changing adoption behavior.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve lifecycle duplicate precedence and honor namespace workload IDs

Use stable key sorting for logical container environment, container labels, and build labels. Resolve namespace workload overrides during asynchronous persistent ownership settlement, retaining startup leases on lookup or recording errors and supporting overrides without a global default.

Co-authored-by: Copilot App <[email protected]>

* Honor namespace network ownership and stable label hashing

Resolve workload annotation overrides during persistent network lease settlement, retaining leases on namespace lookup failures, and preserve duplicate label precedence in lifecycle keys.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Import Aspire regression scaffold compatibility fix from #292

Preserve all build directives selected by the daily CLI template instead of requiring an explicit SDK directive. Leave generated AppHost validation to Aspire, supporting package-based templates without importing the unrelated watcher or dependency changes from PR #292.

Co-authored-by: Copilot App <[email protected]>

* Release logical container realization inputs after physical handoff

Make the selected runtime ID explicitly pending and clear it together with the generated session name after physical creation or verification. Project inline image references from the physical creation spec instead of retaining an adopted runtime ID as a marker.

Co-authored-by: Copilot App <[email protected]>

* Limit selected network identity to physical handoff

Retain the runtime ID only as a pending adoption input and clear it once the physical resource owns the selected identity.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Use shared integration setup for network workload ownership

Replace per-controller ownership permutations and private environments with one persisted-ownership scenario in the shared real API/controller environment.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Prepare images before network readiness and consume published backing refs

Use logical network readiness and its published physical reference instead of duplicating physical lookups. Create inline image resources before waiting for networks so image preparation can proceed independently.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Focus logical network tests on logical controller contracts

Use shared setup for scoped lifecycle and ownership scenarios, consolidate deletion ordering coverage, move duplicate-label sorting regression to API tests, and remove unrelated cancellation and runtime retry checks.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Add V2 logical process lifecycle management

Delegate process execution to identity-bound physical resources, with session, persistent, and existing lifecycle modes. Record retained process ownership before releasing startup leases, including deletion during launch. Treat process launch errors as terminal.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Capture logical and physical container system diagnostics

Add scoped resource-stream nesting that preserves context, primary bindings, filters, and independent cleanup. Bind V2 container diagnostics by resource UID and forward owned physical container diagnostics to the logical owner's stream, including asynchronous operation failures. Keep resource-file producer names per entry and verify fanout without duplicate process or resource entries. This provides capture and routing only; V2 log subresource registration remains separate.

Co-authored-by: Copilot App <[email protected]>

* Settle logical process persistence before physical deletion

Keep startup settlement and ownership recording in the logical controller before requesting physical deletion. Remove the startup finalizer handshake, deletion-time physical status projection, and the guard introduced to support them.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Expose namespaced V2 container log endpoints

Share watch-driven log storage and query handling across API versions while preserving V1 contracts. Add logical and physical container stdout, stderr, and system streamers with one physical-UID runtime capture, snapshot-only logical source resolution, independent client lifetimes, namespace preservation, and explicit unsupported-source errors. Project backing physical identity into logical status and exercise actual endpoints, cancellation, and existing V1 log behavior.

Co-authored-by: Copilot App <[email protected]>

* Drive namespace cleanup directly from relational metadata

Replace per-kind cleanup handlers with one uncached list and bounded delete executor, preserving dependency ordering and pending-resource diagnostics.

Co-authored-by: Copilot App <[email protected]>

* Keep V2 container log subresources with their parent types

Declare logical and physical container log subresources alongside their parents, retaining only resource-neutral storage construction and contracts in shared log types.

Co-authored-by: Copilot App <[email protected]>

* Use container-specific filenames for V2 log streaming

Co-authored-by: Copilot App <[email protected]>

* Expose V2 image acquisition logs through shared capture sources

Capture pull and build output, serialize image acquisition with exclusive leases, and project image startup and container runtime sources directly onto logical resources. Preserve the V1 watcher handoff, fix nested resource sink failure reporting, and share CaptureFile between V1 and V2 controllers.

Co-authored-by: Copilot App <[email protected]>

* Rename shared V2 logging package for resource consumers

Co-authored-by: Copilot App <[email protected]>

* Expose logical and physical network system logs

Capture UID-scoped network diagnostics and forward physical messages to their immediate logical owner. Register namespaced system-only endpoints using the shared V2 streamer, preserving existing lifecycle handoff and independent followers.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Add logical and physical process log streaming

Capture process output in the physical controller and publish immediate physical log-source snapshots through logical status. Reuse shared V2 streaming and owner-scoped system diagnostics, with direct file redirection for retained processes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Add V2 logical and physical container execution

Separate one-shot runtime execution ownership from logical container targeting. Reuse V2 state-driven reconciliation, captured logging, and ordered namespace cleanup, with real-API regression coverage for launch, cancellation, identity, and creation recovery.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Complete logical container log sources when physical backing disappears

Preserve the original physical source identity in a completed, unavailable descriptor so logical-only followers finish through the existing lifecycle callbacks. Cover physical deletion through an isolated real API server with no physical log request.

Co-authored-by: Copilot App <[email protected]>

* Unify resource log capture filename generation

Use one filename contract for command and runtime captures, preserve V1 startup filenames and runtime capture suffixes, and capture physical image output with ordinary stdout/stderr source names.

Co-authored-by: Copilot App <[email protected]>

* Complete logical process logs when physical backing disappears

Project stable completed log-source identity on every missing-backing reconciliation, including persistence settlement, so logical-only followers finish and status-write conflicts cannot lose completion.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Recover physical processes before forwarding logical stop

Inspect and adopt a matching owned physical process before rechecking creation prerequisites. Exclude mutable stop from immutable configuration comparison and forward it through runtime reconciliation. Cover lost successful-create responses in session and persistent modes through the real API.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Serialize persistent network startups within the same process

Acquire exclusive runtime-name leases so one logical network cannot release another startup's claim. Exercise two same-owner logical networks in the shared real API/controller environment and verify reuse after settlement.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Complete missing-runtime log sources and focus regression coverage

Finish physical and logical followers after confirmed runtime disappearance, wait for image log-writer release in its assertion, and remove unnecessary simulated image aliases. Cover failed pull diagnostics and stream closure at the production Docker/Podman adapter boundary.

Co-authored-by: Copilot App <[email protected]>

* Fix process persistence and output lifecycle review findings

Isolate process lease keys, preserve runtime stop handling during persistence settlement, and select raw capture reader settings. Publish output completion after pipe drainage and retry capture disposal through existing cleanup helpers and reconciliation. Add focused regressions and remove the cleanup test's file-restoration race.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Fail logical processes when physical backing disappears

Treat loss of handed-off physical backing as terminal, preserve completed log-source identity, and release startup leases without recreating resources or reconstructing runtime ownership. Cover startup and ownership-recording loss, status conflicts, and namespace deletion.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Correct logical network ownership settlement and startup failure propagation

Use operation-local ownership candidates from verified physical observations, settle retained startup before child deletion, and release canceled pre-handoff leases without runtime-name ownership discovery. Preserve namespace cleanup when termination prevents physical startup, including a committed Create with a lost response.

Surface terminal image failure while logical network dependencies remain unavailable and keep startup failure latched after dependency recovery.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Make DCP runtime labels override duplicate caller values

Update every matching label entry in the shared setter while preserving unrelated labels and their ordering. Cover reserved ownership labels, caller immutability, and persistent-network reuse with duplicate lifecycle labels.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Require exclusive V1 persistent network creation leases

Forward lease options through WithResourceLease and opt V1 network creation into same-process exclusivity. Keep release within the callback scope instead of issuing redundant status-driven releases that can remove a later startup's lease.

Cover wrapper exclusivity and real-API V1/V2 creation serialization, shared runtime references, and retained workload registration.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Stop scheduled retries for confirmed missing runtime networks

Match the physical-container Unknown/missing projection without periodic requeue. Preserve event-driven observation of the pinned runtime ID and retry transient inspection failures.

Cover retry-policy parity, retained identity and details, same-name replacement isolation, and deletion without removing the replacement.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Match parent deletion ordering for missing runtime networks

For a current-generation confirmed-missing runtime observation, delete the verified owned physical backing and settle the creation lease without an ownership candidate after its disappearance. Preserve normal runtime observation and retain retries for inspection failures.

Cover runtime removal before and during logical deletion while namespace workload lookup remains unavailable, with no persistent record and successful namespace cleanup.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Bound container exec output drain after host exit

Apply the existing two-second process output-drain limit to Docker, Podman, and WSLC exec sessions. Preserve best-effort cleanup without requiring universal host or in-container termination confirmation.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Protect logical backing lifetimes and settle image inspections

Hold owned physical containers and inline images until logical cleanup permits release. Preserve operation outcomes through status conflicts, clean up dependency-pending startup, and verify uncertain backing creates immediately.

Limit logical startup output to owned images, bound image inspection retries, and align reconciliation and integration tests with repository patterns.

Co-authored-by: Copilot App <[email protected]>

* Hold physical networks until their logical owner authorizes deletion

Initialize logical and physical finalizers atomically, continue physical observation while held, and release the logical hold only after stable current-generation outcomes and required ownership settlement. Preserve release authorization across lost responses and treat unauthorized backing loss as terminal.

Align logical network deletion bookkeeping and data lifetime with the parent container protocol. Permit held deleting network dependencies and cover durable status, independent finalizers, uncertain release, finalizer conflicts, early deletion, and protocol violations through the real API.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align physical resource reconciliation and namespace guards

Move physical resource initialization, state updates, and status projection into management and deletion handlers. Discard completed container and image data alongside finalizer removal, and release resource logs during cleanup.

Replace namespace state-machine stages with a common V2 namespace guard while preserving operation settlement and logical backing holds.

Co-authored-by: Copilot App <[email protected]>

* Align logical network handoff cleanup with containers

Remove redundant stale-UID state recovery and clear the generated runtime name after verified physical handoff. Keep pre-handoff inputs intact for uncertain-Create deletion verification.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Make V2 finalizer sequencing explicit

Use an explicit ensureFinalizer call followed by management only when no finalizer change is needed, matching the network controller's control flow without changing deletion guards.

Co-authored-by: Copilot App <[email protected]>

* Make logical network finalizer sequencing explicit

Preserve the compound deletion and operation guard while separating finalizer updates from management, matching the parent V2 controller pattern.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Use shared namespace guard for logical process prerequisites

Adapt logical process initialization and physical creation checks to the updated parent namespace guard without restoring the removed helper.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Simplify V2 reconciliation and logical backing coordination

Separate granular lifecycle states from outstanding asynchronous work. Discover logical backings by owner metadata, require expected children before handoff, and propagate deletion to every owned child.

Preserve cleanup status before releasing finalizers, keep adopted runtimes out of workload ownership records, and retry post-pull image inspection without repeating acquisition.

Co-authored-by: Copilot App <[email protected]>

* Stop existing replacement targets and settle workloads on identity

Acquire and stop the existing named runtime when stop and replace are requested before physical creation. Settle logical workload registration when the physical runtime ID is reported, without waiting for a settled lifecycle phase.

Co-authored-by: Copilot App <[email protected]>

* Release runtime captures through observed log sources

Use a log-source provider capability for primary capture identity and release the observed source UID on deletion, including logical-only log consumers. Preserve existing startup and completion handling.

Co-authored-by: Copilot App <[email protected]>

* Cover bounded volume removal during namespace deletion

Exercise the real API and running controllers with an in-use volume, verifying the grace period, abandonment status, finalizer release, and completion of namespace deletion using existing test infrastructure.

Co-authored-by: Copilot App <[email protected]>

* Remove unused V1 resource streamer adapter

Co-authored-by: Copilot App <[email protected]>

* Append authoritative DCP runtime labels after caller labels

Remove the first-match setter and rely on last-value-wins conversion so duplicate caller labels cannot override system metadata. Cover physical label collisions and persistent logical-container reuse.

Co-authored-by: Copilot App <[email protected]>

* Synchronize log readiness with resource lifecycle processing

Dispatch lifecycle events in per-resource FIFO order and replace request event backlogs with coalesced latest-state notifications. Share a per-resource RW lock across snapshot processing and lifecycle callbacks so deletion cannot overtake requests processing the previous state, while allowing concurrent readers.

Cover latest-state consumption, both deletion/registration orderings, concurrent requests, cross-resource progress, scheduling fairness, and disposal. Preserve existing streamer and finite-copy behavior.

Co-authored-by: Copilot App <[email protected]>

* Requeue image acquisition when exclusive pull leases are held

Acquire pull leases once per operation attempt instead of waiting inside the bounded worker queue. Keep direct pulls and build-base acquisition pending on contention and retry through normal reconciliation without consuming pull retries.

Allow WithResourceLease to forward existing acquisition options so single-attempt calls retain exclusivity and automatic release. Cover same-process contention, unrelated work progress, and recovery after lease release.

Co-authored-by: Copilot App <[email protected]>

* Align V2 lifecycle-key collection ordering with V1

Sort mounts by target, ports by protocol and host port, copied files by destination, and build secrets by ID before hashing the copied configuration. Preserve equal-key declaration order and caller-provided digest behavior.

Cover reordering equivalence, meaningful ordering, input immutability, and persistent runtime reuse after port reordering. Leave acquisition-policy inclusion unchanged.

Co-authored-by: Copilot App <[email protected]>

* Exclude dynamic networks from V2 container lifecycle keys

Match V1 by omitting network attachments and aliases from the copied configuration used for hashing. Preserve the declared spec and avoid making dynamic connection changes trigger persistent container replacement.

Cover membership, ordering, aliases, empty inputs, and immutability; update the intentional V2 golden key and resource plan.

Co-authored-by: Copilot App <[email protected]>

* Separate namespace readiness checks from controller status policy

Return readiness, condition reason, and lookup error from a read-only namespace check. Let all six callers choose their phases, Ready conditions, logging, and reconciliation flags while preserving existing admission behavior.

Document the reduced helper contract and cover initial lookup failure, recovery, and post-initialization stop behavior through the real API/controller environment.

Co-authored-by: Copilot App <[email protected]>

* Clarify logical container backing lookup diagnostic

Use the reviewer's suggested message to describe listing the physical containers backing the logical resource.

Co-authored-by: Copilot App <[email protected]>

* Confirm recorded logical backings are absent before deletion completes

When a physical UID is recorded but the cached owner list is empty, confirm absence through an uncached namespace list filtered by controller-owner UID. Reuse existing container/image deletion loops for discovered children and retry lookup errors without releasing the logical finalizer.

Cover successful creation before cache observation, duplicate owned backings, unrelated resource preservation, and cleanup completion after actual removal. Document the UID-gated confirmation rule.

Co-authored-by: Copilot App <[email protected]>

* Copy finite stdio logs asynchronously

Return a completion channel for non-follow and completed-resource log copies so client backpressure does not hold resource processing locks. Preserve first-EOF behavior without registering lifecycle followers, and let storage cancellation close the response pipe to unblock delivery.

Cover finite-copy formatting, EOF, slow readers, lifecycle progress, request cancellation, and storage disposal.

Co-authored-by: Copilot App <[email protected]>

* Resolve network declarations without duplicating physical dependency gates

Use a published physical network reference without requiring logical readiness, while rejecting terminal logical network failure and settling the creation lease. Remove extra image observation and failure handling from Pending; retain the parent's inline-image declaration and log projection unchanged.

Verify physical-container declaration while network startup is blocked, physical-owned image failure propagation after references resolve, terminal network rejection, and unchanged adopted attachments. Update the published API reference contract and generated OpenAPI documentation.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Separate logical network reconciliation steps with whitespace

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align logical network running handler naming with containers

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align logical network state transitions with logical containers

Rely on child observation after successful preparation, avoid follow-up retries for terminal duplicate discovery, and consume physical Ready with a true Ready condition without redundant identity or generation gates. Preserve accumulated lease-settlement changes during handoff.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Colocate controller state strings with their enum definitions

Move all seven existing String methods unchanged into the respective controller data files and remove the centralized state-string file. Keep shared diagnostic tests in place.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Fail container startup on terminal dependency failures

Treat failed network and volume references like failed image references, preserving dependency diagnostics and releasing unused startup leases without resuming after replacement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Evaluate all container dependencies with shared lifecycle states

Prevent pending prerequisites from hiding later failures or required retries. Share dependency preparation states and condition reasons across resource kinds while retaining dependency diagnostics, terminal latching, and lease settlement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve and reuse retained process output files

Store process capture paths for persistent reuse and pass optional output files to identity-bound physical PID references. Remove recorded captures when replacing or cleaning up exited V2 processes while preserving V1 startup cleanup behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Align logical process state management with parent controllers

Coordinate lifecycle preparation and persistence directly during reconciliation, admit namespaces before initializing state, and preserve lifecycle states across retry diagnostics. Remove logical asynchronous operation machinery and cover backing observation recovery and deletion before namespace admission.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Match V1 network harvest protection and retry behavior

Inspect runtime networks even when startup-harvest protection is contended, and wait only before reusing a found network. Allow missing persistent networks to be created during harvesting and use ordinary short retries for reuse contention without adding retry-delay state.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Verify logical backing absence by owner before finalizing deletion

Confirm every empty cached owner list through the uncached reader, including after committed Creates whose response did not provide a backing UID. Cover unrecorded network, container, and image backings, confirmation failures, cleanup, and unrelated-resource preservation through running controllers.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve terminal dependency failure before replacement stop

Keep ended startup attempts from resolving and claiming replacement targets after stop is requested. Cover existing and missing runtime targets while retaining nonterminal replacement-stop behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Keep owned startup logs current after preparation failure

Continue observing and projecting existing inline image acquisition logs while logical container preparation is terminal. Preserve independent dependency work and lease settlement without reordering declarations or restarting startup.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve adopted network lifecycle keys across uncertain handoff

Retain selected lifecycle identity independently of a decoded physical backing UID, following the parent logical container pattern. Cover failed confirmation and later owner discovery without adding runtime recovery or changing lease settlement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Clarify container network and physical resource terminology

Name backing container networks directly in comments, diagnostics, documentation, and local identifiers. Reserve physical wording for V2 API resources and retain public identifiers and genuine container-engine references.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Isolate retained launch gates and parallelize deletion tests

Gate retained process startup through per-test executor decoration outside the shared executor mutex. Run deletion cases in parallel and verify an unrelated process can launch while the retained launch is paused.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Align process backing lifetime with shared logical holds

Create physical backings with both cleanup finalizers, request deletion before persistence settlement, and retain backing observations until workload registration and startup lease release finish. Confirm missing primary or replacement backings uncached and preserve terminal handling of unauthorized backing loss.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Normalize process lifecycle keys using effective environment values

Encode selected process fields individually and normalize explicit environment declarations with platform-aware last-value-wins semantics. Preserve inheritance defaults, explicit keys and V1 hashing, with differential environment-equivalence coverage.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Preserve retained process capture across session cleanup

Share V1's persistent process output directory with retained V2 captures, and honor executable log preservation when disposing created process output. Cover session cleanup followed by adoption, preserved session and persistent output, and unchanged directory configuration/elevation behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Increase default Go package test timeout to twenty minutes

Set the shared local/CI test timeout explicitly and keep the Windows CI driver aligned without changing per-test contexts or parallelism.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Project process output completion while logical deletion waits

Continue projecting the verified physical backing snapshot during cleanup so logical-only followers can drain and release capture readers. Preserve completion changes across deletion returns and cover namespace deletion without starting a physical log watch.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Preserve workload ownership during unscoped process reuse

Only replace an existing process workload association when the resolved workload ID is nonempty. Cover scoped-to-unscoped reuse and ownerless replacement in the existing integration regression.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Align container exec controllers with shared backing lifecycle patterns

Use namespace admission before initialization, independent coordination errors, owner-indexed child observation, and shared logical backing holds. Preserve durable final disposition and held output capture, retry disposal, and cover late followers and lost finalizer responses with real API regressions. Clarify bounded best-effort runtime completion.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Clarify process and backing resource terminology

Distinguish operating system processes from PhysicalProcess API resources in comments, documentation, and generated schema descriptions. No behavioral or public identifier changes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Use ambient environment behavior in V2 process APIs

Replace the inheritance boolean with V2-owned ambientEnvironment.behavior in both logical and physical process configurations. Preserve inheritance defaults, explicit environment precedence, and published lifecycle keys; validate supported behaviors and keep the generated API artifacts in sync.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Restore best-effort process output cleanup and address review feedback

Cache bounded capture disposal with OnceValue and log output-removal failures without blocking process finalization, replacement, or retirement of confirmed-gone records. Update cleanup regressions and documentation, share the process key prefix, clarify log-stream completion and raw filtering, and distinguish missing process data from the API object.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Queue V2 output cleanup outside reconciliation

Share a host-lifetime bounded cleanup queue across process and image reconcilers. Preserve capture-drain ordering and best-effort disposal, reuse CloseAndLog, and keep file removal independent of resource finalization and process operations. Cover blocked cleanup through the real API, await asynchronous removal in existing tests, and consolidate overlapping serial log coverage.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Clarify process capture cleanup and identity contracts

Document best-effort capture removal on resource deletion after process exit or confirmed absence, including PID reuse. Clarify the identity timestamp's use for subsequent persistent-process PID-reuse protection and retain the Linux since-boot distinction.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Avoid resource-scoped loggers in queued exec cleanup

Use the controller logger with execution name and UID for asynchronous capture disposal so late cleanup errors cannot reopen released resource log sinks.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Report confirmed runtime container absence as failed

Project Missing as Failed with RuntimeContainerMissing so logical containers and exec prerequisites reject confirmed absence through existing failure handling. Keep transient Unknown retryable and deletion completion independent of phase.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Share output preservation policy across resource capture cleanup

Honor DCP_PRESERVE_EXECUTABLE_LOGS in shared capture and path cleanup, including image acquisition and runtime-container log descriptors. Keep writer closure and explicit CaptureFile disposal independent of retention policy; cover preservation and normal removal with shared and real API regressions.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Report specific container exec preflight failure causes

Avoid formatting nil lookup errors for changed, deleting, or terminal targets. Preserve ContainerUnavailable handling and assert the resulting diagnostic through the real API.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Record shared Get telemetry for container exec reconcilers

Count successful, failed, and NotFound initial resource reads consistently with the other controllers.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Filter unchanged exec namespace and backing watch updates

Apply ResourceVersionChangedPredicate to namespace watches and logical exec's owned physical watch, matching established V2 controller registrations.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Use a shared resource-neutral exit code setter

Move setExitCode beside common status setters and update process and container exec callers without changing comparison or cloning behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Cover V2 container exec through real runtime integration

Add runtime-gated API/controller coverage using shared runtime discovery, resource tracking, and the container probe. Exercise inputs, output and exit results, attached execution deletion, target exit, and exited-target rejection. Real-runtime execution is reserved for enabled CI.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

---------

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6
David Negstad (danegsta) added a commit that referenced this pull request Nov 7, 2026
* Add V2 logical container resource foundation

Introduce logical container and network APIs, delegate logical container lifecycle operations to physical resources, and track persistent workload ownership. Standardize V2 deletion dispatch and terminal startup/stop outcomes with shared API-backed coverage.

Co-authored-by: Copilot App <[email protected]>

* Replace synthetic V2 controller tests with behavioral coverage

Exercise logical readiness through the shared API server and running physical controller using runtime port-mapping fault injection. Remove redundant private deletion-handler tests already covered by retained-resource integration cases.

Co-authored-by: Copilot App <[email protected]>

* Add V2 logical container network lifecycle controller

Delegate runtime network realization to physical resources, manage persistent lifecycle keys and shared leases, and translate logical network attachments for new containers without changing adoption behavior.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve lifecycle duplicate precedence and honor namespace workload IDs

Use stable key sorting for logical container environment, container labels, and build labels. Resolve namespace workload overrides during asynchronous persistent ownership settlement, retaining startup leases on lookup or recording errors and supporting overrides without a global default.

Co-authored-by: Copilot App <[email protected]>

* Honor namespace network ownership and stable label hashing

Resolve workload annotation overrides during persistent network lease settlement, retaining leases on namespace lookup failures, and preserve duplicate label precedence in lifecycle keys.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Import Aspire regression scaffold compatibility fix from #292

Preserve all build directives selected by the daily CLI template instead of requiring an explicit SDK directive. Leave generated AppHost validation to Aspire, supporting package-based templates without importing the unrelated watcher or dependency changes from PR #292.

Co-authored-by: Copilot App <[email protected]>

* Release logical container realization inputs after physical handoff

Make the selected runtime ID explicitly pending and clear it together with the generated session name after physical creation or verification. Project inline image references from the physical creation spec instead of retaining an adopted runtime ID as a marker.

Co-authored-by: Copilot App <[email protected]>

* Limit selected network identity to physical handoff

Retain the runtime ID only as a pending adoption input and clear it once the physical resource owns the selected identity.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Use shared integration setup for network workload ownership

Replace per-controller ownership permutations and private environments with one persisted-ownership scenario in the shared real API/controller environment.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Prepare images before network readiness and consume published backing refs

Use logical network readiness and its published physical reference instead of duplicating physical lookups. Create inline image resources before waiting for networks so image preparation can proceed independently.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Focus logical network tests on logical controller contracts

Use shared setup for scoped lifecycle and ownership scenarios, consolidate deletion ordering coverage, move duplicate-label sorting regression to API tests, and remove unrelated cancellation and runtime retry checks.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Add V2 logical process lifecycle management

Delegate process execution to identity-bound physical resources, with session, persistent, and existing lifecycle modes. Record retained process ownership before releasing startup leases, including deletion during launch. Treat process launch errors as terminal.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Capture logical and physical container system diagnostics

Add scoped resource-stream nesting that preserves context, primary bindings, filters, and independent cleanup. Bind V2 container diagnostics by resource UID and forward owned physical container diagnostics to the logical owner's stream, including asynchronous operation failures. Keep resource-file producer names per entry and verify fanout without duplicate process or resource entries. This provides capture and routing only; V2 log subresource registration remains separate.

Co-authored-by: Copilot App <[email protected]>

* Settle logical process persistence before physical deletion

Keep startup settlement and ownership recording in the logical controller before requesting physical deletion. Remove the startup finalizer handshake, deletion-time physical status projection, and the guard introduced to support them.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Expose namespaced V2 container log endpoints

Share watch-driven log storage and query handling across API versions while preserving V1 contracts. Add logical and physical container stdout, stderr, and system streamers with one physical-UID runtime capture, snapshot-only logical source resolution, independent client lifetimes, namespace preservation, and explicit unsupported-source errors. Project backing physical identity into logical status and exercise actual endpoints, cancellation, and existing V1 log behavior.

Co-authored-by: Copilot App <[email protected]>

* Drive namespace cleanup directly from relational metadata

Replace per-kind cleanup handlers with one uncached list and bounded delete executor, preserving dependency ordering and pending-resource diagnostics.

Co-authored-by: Copilot App <[email protected]>

* Keep V2 container log subresources with their parent types

Declare logical and physical container log subresources alongside their parents, retaining only resource-neutral storage construction and contracts in shared log types.

Co-authored-by: Copilot App <[email protected]>

* Use container-specific filenames for V2 log streaming

Co-authored-by: Copilot App <[email protected]>

* Expose V2 image acquisition logs through shared capture sources

Capture pull and build output, serialize image acquisition with exclusive leases, and project image startup and container runtime sources directly onto logical resources. Preserve the V1 watcher handoff, fix nested resource sink failure reporting, and share CaptureFile between V1 and V2 controllers.

Co-authored-by: Copilot App <[email protected]>

* Rename shared V2 logging package for resource consumers

Co-authored-by: Copilot App <[email protected]>

* Expose logical and physical network system logs

Capture UID-scoped network diagnostics and forward physical messages to their immediate logical owner. Register namespaced system-only endpoints using the shared V2 streamer, preserving existing lifecycle handoff and independent followers.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Add logical and physical process log streaming

Capture process output in the physical controller and publish immediate physical log-source snapshots through logical status. Reuse shared V2 streaming and owner-scoped system diagnostics, with direct file redirection for retained processes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Add V2 logical and physical container execution

Separate one-shot runtime execution ownership from logical container targeting. Reuse V2 state-driven reconciliation, captured logging, and ordered namespace cleanup, with real-API regression coverage for launch, cancellation, identity, and creation recovery.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Complete logical container log sources when physical backing disappears

Preserve the original physical source identity in a completed, unavailable descriptor so logical-only followers finish through the existing lifecycle callbacks. Cover physical deletion through an isolated real API server with no physical log request.

Co-authored-by: Copilot App <[email protected]>

* Unify resource log capture filename generation

Use one filename contract for command and runtime captures, preserve V1 startup filenames and runtime capture suffixes, and capture physical image output with ordinary stdout/stderr source names.

Co-authored-by: Copilot App <[email protected]>

* Complete logical process logs when physical backing disappears

Project stable completed log-source identity on every missing-backing reconciliation, including persistence settlement, so logical-only followers finish and status-write conflicts cannot lose completion.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Recover physical processes before forwarding logical stop

Inspect and adopt a matching owned physical process before rechecking creation prerequisites. Exclude mutable stop from immutable configuration comparison and forward it through runtime reconciliation. Cover lost successful-create responses in session and persistent modes through the real API.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Serialize persistent network startups within the same process

Acquire exclusive runtime-name leases so one logical network cannot release another startup's claim. Exercise two same-owner logical networks in the shared real API/controller environment and verify reuse after settlement.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Complete missing-runtime log sources and focus regression coverage

Finish physical and logical followers after confirmed runtime disappearance, wait for image log-writer release in its assertion, and remove unnecessary simulated image aliases. Cover failed pull diagnostics and stream closure at the production Docker/Podman adapter boundary.

Co-authored-by: Copilot App <[email protected]>

* Fix process persistence and output lifecycle review findings

Isolate process lease keys, preserve runtime stop handling during persistence settlement, and select raw capture reader settings. Publish output completion after pipe drainage and retry capture disposal through existing cleanup helpers and reconciliation. Add focused regressions and remove the cleanup test's file-restoration race.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Fail logical processes when physical backing disappears

Treat loss of handed-off physical backing as terminal, preserve completed log-source identity, and release startup leases without recreating resources or reconstructing runtime ownership. Cover startup and ownership-recording loss, status conflicts, and namespace deletion.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Correct logical network ownership settlement and startup failure propagation

Use operation-local ownership candidates from verified physical observations, settle retained startup before child deletion, and release canceled pre-handoff leases without runtime-name ownership discovery. Preserve namespace cleanup when termination prevents physical startup, including a committed Create with a lost response.

Surface terminal image failure while logical network dependencies remain unavailable and keep startup failure latched after dependency recovery.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Make DCP runtime labels override duplicate caller values

Update every matching label entry in the shared setter while preserving unrelated labels and their ordering. Cover reserved ownership labels, caller immutability, and persistent-network reuse with duplicate lifecycle labels.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Require exclusive V1 persistent network creation leases

Forward lease options through WithResourceLease and opt V1 network creation into same-process exclusivity. Keep release within the callback scope instead of issuing redundant status-driven releases that can remove a later startup's lease.

Cover wrapper exclusivity and real-API V1/V2 creation serialization, shared runtime references, and retained workload registration.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Stop scheduled retries for confirmed missing runtime networks

Match the physical-container Unknown/missing projection without periodic requeue. Preserve event-driven observation of the pinned runtime ID and retry transient inspection failures.

Cover retry-policy parity, retained identity and details, same-name replacement isolation, and deletion without removing the replacement.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Match parent deletion ordering for missing runtime networks

For a current-generation confirmed-missing runtime observation, delete the verified owned physical backing and settle the creation lease without an ownership candidate after its disappearance. Preserve normal runtime observation and retain retries for inspection failures.

Cover runtime removal before and during logical deletion while namespace workload lookup remains unavailable, with no persistent record and successful namespace cleanup.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Bound container exec output drain after host exit

Apply the existing two-second process output-drain limit to Docker, Podman, and WSLC exec sessions. Preserve best-effort cleanup without requiring universal host or in-container termination confirmation.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Protect logical backing lifetimes and settle image inspections

Hold owned physical containers and inline images until logical cleanup permits release. Preserve operation outcomes through status conflicts, clean up dependency-pending startup, and verify uncertain backing creates immediately.

Limit logical startup output to owned images, bound image inspection retries, and align reconciliation and integration tests with repository patterns.

Co-authored-by: Copilot App <[email protected]>

* Hold physical networks until their logical owner authorizes deletion

Initialize logical and physical finalizers atomically, continue physical observation while held, and release the logical hold only after stable current-generation outcomes and required ownership settlement. Preserve release authorization across lost responses and treat unauthorized backing loss as terminal.

Align logical network deletion bookkeeping and data lifetime with the parent container protocol. Permit held deleting network dependencies and cover durable status, independent finalizers, uncertain release, finalizer conflicts, early deletion, and protocol violations through the real API.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align physical resource reconciliation and namespace guards

Move physical resource initialization, state updates, and status projection into management and deletion handlers. Discard completed container and image data alongside finalizer removal, and release resource logs during cleanup.

Replace namespace state-machine stages with a common V2 namespace guard while preserving operation settlement and logical backing holds.

Co-authored-by: Copilot App <[email protected]>

* Align logical network handoff cleanup with containers

Remove redundant stale-UID state recovery and clear the generated runtime name after verified physical handoff. Keep pre-handoff inputs intact for uncertain-Create deletion verification.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Make V2 finalizer sequencing explicit

Use an explicit ensureFinalizer call followed by management only when no finalizer change is needed, matching the network controller's control flow without changing deletion guards.

Co-authored-by: Copilot App <[email protected]>

* Make logical network finalizer sequencing explicit

Preserve the compound deletion and operation guard while separating finalizer updates from management, matching the parent V2 controller pattern.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Use shared namespace guard for logical process prerequisites

Adapt logical process initialization and physical creation checks to the updated parent namespace guard without restoring the removed helper.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Simplify V2 reconciliation and logical backing coordination

Separate granular lifecycle states from outstanding asynchronous work. Discover logical backings by owner metadata, require expected children before handoff, and propagate deletion to every owned child.

Preserve cleanup status before releasing finalizers, keep adopted runtimes out of workload ownership records, and retry post-pull image inspection without repeating acquisition.

Co-authored-by: Copilot App <[email protected]>

* Stop existing replacement targets and settle workloads on identity

Acquire and stop the existing named runtime when stop and replace are requested before physical creation. Settle logical workload registration when the physical runtime ID is reported, without waiting for a settled lifecycle phase.

Co-authored-by: Copilot App <[email protected]>

* Release runtime captures through observed log sources

Use a log-source provider capability for primary capture identity and release the observed source UID on deletion, including logical-only log consumers. Preserve existing startup and completion handling.

Co-authored-by: Copilot App <[email protected]>

* Cover bounded volume removal during namespace deletion

Exercise the real API and running controllers with an in-use volume, verifying the grace period, abandonment status, finalizer release, and completion of namespace deletion using existing test infrastructure.

Co-authored-by: Copilot App <[email protected]>

* Remove unused V1 resource streamer adapter

Co-authored-by: Copilot App <[email protected]>

* Append authoritative DCP runtime labels after caller labels

Remove the first-match setter and rely on last-value-wins conversion so duplicate caller labels cannot override system metadata. Cover physical label collisions and persistent logical-container reuse.

Co-authored-by: Copilot App <[email protected]>

* Synchronize log readiness with resource lifecycle processing

Dispatch lifecycle events in per-resource FIFO order and replace request event backlogs with coalesced latest-state notifications. Share a per-resource RW lock across snapshot processing and lifecycle callbacks so deletion cannot overtake requests processing the previous state, while allowing concurrent readers.

Cover latest-state consumption, both deletion/registration orderings, concurrent requests, cross-resource progress, scheduling fairness, and disposal. Preserve existing streamer and finite-copy behavior.

Co-authored-by: Copilot App <[email protected]>

* Requeue image acquisition when exclusive pull leases are held

Acquire pull leases once per operation attempt instead of waiting inside the bounded worker queue. Keep direct pulls and build-base acquisition pending on contention and retry through normal reconciliation without consuming pull retries.

Allow WithResourceLease to forward existing acquisition options so single-attempt calls retain exclusivity and automatic release. Cover same-process contention, unrelated work progress, and recovery after lease release.

Co-authored-by: Copilot App <[email protected]>

* Align V2 lifecycle-key collection ordering with V1

Sort mounts by target, ports by protocol and host port, copied files by destination, and build secrets by ID before hashing the copied configuration. Preserve equal-key declaration order and caller-provided digest behavior.

Cover reordering equivalence, meaningful ordering, input immutability, and persistent runtime reuse after port reordering. Leave acquisition-policy inclusion unchanged.

Co-authored-by: Copilot App <[email protected]>

* Exclude dynamic networks from V2 container lifecycle keys

Match V1 by omitting network attachments and aliases from the copied configuration used for hashing. Preserve the declared spec and avoid making dynamic connection changes trigger persistent container replacement.

Cover membership, ordering, aliases, empty inputs, and immutability; update the intentional V2 golden key and resource plan.

Co-authored-by: Copilot App <[email protected]>

* Separate namespace readiness checks from controller status policy

Return readiness, condition reason, and lookup error from a read-only namespace check. Let all six callers choose their phases, Ready conditions, logging, and reconciliation flags while preserving existing admission behavior.

Document the reduced helper contract and cover initial lookup failure, recovery, and post-initialization stop behavior through the real API/controller environment.

Co-authored-by: Copilot App <[email protected]>

* Clarify logical container backing lookup diagnostic

Use the reviewer's suggested message to describe listing the physical containers backing the logical resource.

Co-authored-by: Copilot App <[email protected]>

* Confirm recorded logical backings are absent before deletion completes

When a physical UID is recorded but the cached owner list is empty, confirm absence through an uncached namespace list filtered by controller-owner UID. Reuse existing container/image deletion loops for discovered children and retry lookup errors without releasing the logical finalizer.

Cover successful creation before cache observation, duplicate owned backings, unrelated resource preservation, and cleanup completion after actual removal. Document the UID-gated confirmation rule.

Co-authored-by: Copilot App <[email protected]>

* Copy finite stdio logs asynchronously

Return a completion channel for non-follow and completed-resource log copies so client backpressure does not hold resource processing locks. Preserve first-EOF behavior without registering lifecycle followers, and let storage cancellation close the response pipe to unblock delivery.

Cover finite-copy formatting, EOF, slow readers, lifecycle progress, request cancellation, and storage disposal.

Co-authored-by: Copilot App <[email protected]>

* Resolve network declarations without duplicating physical dependency gates

Use a published physical network reference without requiring logical readiness, while rejecting terminal logical network failure and settling the creation lease. Remove extra image observation and failure handling from Pending; retain the parent's inline-image declaration and log projection unchanged.

Verify physical-container declaration while network startup is blocked, physical-owned image failure propagation after references resolve, terminal network rejection, and unchanged adopted attachments. Update the published API reference contract and generated OpenAPI documentation.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Separate logical network reconciliation steps with whitespace

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align logical network running handler naming with containers

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Align logical network state transitions with logical containers

Rely on child observation after successful preparation, avoid follow-up retries for terminal duplicate discovery, and consume physical Ready with a true Ready condition without redundant identity or generation gates. Preserve accumulated lease-settlement changes during handoff.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Colocate controller state strings with their enum definitions

Move all seven existing String methods unchanged into the respective controller data files and remove the centralized state-string file. Keep shared diagnostic tests in place.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Fail container startup on terminal dependency failures

Treat failed network and volume references like failed image references, preserving dependency diagnostics and releasing unused startup leases without resuming after replacement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Evaluate all container dependencies with shared lifecycle states

Prevent pending prerequisites from hiding later failures or required retries. Share dependency preparation states and condition reasons across resource kinds while retaining dependency diagnostics, terminal latching, and lease settlement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve and reuse retained process output files

Store process capture paths for persistent reuse and pass optional output files to identity-bound physical PID references. Remove recorded captures when replacing or cleaning up exited V2 processes while preserving V1 startup cleanup behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Align logical process state management with parent controllers

Coordinate lifecycle preparation and persistence directly during reconciliation, admit namespaces before initializing state, and preserve lifecycle states across retry diagnostics. Remove logical asynchronous operation machinery and cover backing observation recovery and deletion before namespace admission.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Match V1 network harvest protection and retry behavior

Inspect runtime networks even when startup-harvest protection is contended, and wait only before reusing a found network. Allow missing persistent networks to be created during harvesting and use ordinary short retries for reuse contention without adding retry-delay state.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Verify logical backing absence by owner before finalizing deletion

Confirm every empty cached owner list through the uncached reader, including after committed Creates whose response did not provide a backing UID. Cover unrecorded network, container, and image backings, confirmation failures, cleanup, and unrelated-resource preservation through running controllers.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve terminal dependency failure before replacement stop

Keep ended startup attempts from resolving and claiming replacement targets after stop is requested. Cover existing and missing runtime targets while retaining nonterminal replacement-stop behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Keep owned startup logs current after preparation failure

Continue observing and projecting existing inline image acquisition logs while logical container preparation is terminal. Preserve independent dependency work and lease settlement without reordering declarations or restarting startup.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Preserve adopted network lifecycle keys across uncertain handoff

Retain selected lifecycle identity independently of a decoded physical backing UID, following the parent logical container pattern. Cover failed confirmation and later owner discovery without adding runtime recovery or changing lease settlement.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Clarify container network and physical resource terminology

Name backing container networks directly in comments, diagnostics, documentation, and local identifiers. Reserve physical wording for V2 API resources and retain public identifiers and genuine container-engine references.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2

* Isolate retained launch gates and parallelize deletion tests

Gate retained process startup through per-test executor decoration outside the shared executor mutex. Run deletion cases in parallel and verify an unrelated process can launch while the retained launch is paused.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Align process backing lifetime with shared logical holds

Create physical backings with both cleanup finalizers, request deletion before persistence settlement, and retain backing observations until workload registration and startup lease release finish. Confirm missing primary or replacement backings uncached and preserve terminal handling of unauthorized backing loss.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Normalize process lifecycle keys using effective environment values

Encode selected process fields individually and normalize explicit environment declarations with platform-aware last-value-wins semantics. Preserve inheritance defaults, explicit keys and V1 hashing, with differential environment-equivalence coverage.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Preserve retained process capture across session cleanup

Share V1's persistent process output directory with retained V2 captures, and honor executable log preservation when disposing created process output. Cover session cleanup followed by adoption, preserved session and persistent output, and unchanged directory configuration/elevation behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Increase default Go package test timeout to twenty minutes

Set the shared local/CI test timeout explicitly and keep the Windows CI driver aligned without changing per-test contexts or parallelism.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Project process output completion while logical deletion waits

Continue projecting the verified physical backing snapshot during cleanup so logical-only followers can drain and release capture readers. Preserve completion changes across deletion returns and cover namespace deletion without starting a physical log watch.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Preserve workload ownership during unscoped process reuse

Only replace an existing process workload association when the resolved workload ID is nonempty. Cover scoped-to-unscoped reuse and ownerless replacement in the existing integration regression.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Align container exec controllers with shared backing lifecycle patterns

Use namespace admission before initialization, independent coordination errors, owner-indexed child observation, and shared logical backing holds. Preserve durable final disposition and held output capture, retry disposal, and cover late followers and lost finalizer responses with real API regressions. Clarify bounded best-effort runtime completion.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Add V2 services, service-backed ports, and logical value templates

Co-authored-by: Copilot App <[email protected]>

* Normalize logical environment overrides before template evaluation

Co-authored-by: Copilot App <[email protected]>

* Clarify process and backing resource terminology

Distinguish operating system processes from PhysicalProcess API resources in comments, documentation, and generated schema descriptions. No behavioral or public identifier changes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Fix IPv6 service authorities and existing-process port validation

Co-authored-by: Copilot App <[email protected]>

* Use ambient environment behavior in V2 process APIs

Replace the inheritance boolean with V2-owned ambientEnvironment.behavior in both logical and physical process configurations. Preserve inheritance defaults, explicit environment precedence, and published lifecycle keys; validate supported behaviors and keep the generated API artifacts in sync.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Restore best-effort process output cleanup and address review feedback

Cache bounded capture disposal with OnceValue and log output-removal failures without blocking process finalization, replacement, or retirement of confirmed-gone records. Update cleanup regressions and documentation, share the process key prefix, clarify log-stream completion and raw filtering, and distinguish missing process data from the API object.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Queue V2 output cleanup outside reconciliation

Share a host-lifetime bounded cleanup queue across process and image reconcilers. Preserve capture-drain ordering and best-effort disposal, reuse CloseAndLog, and keep file removal independent of resource finalization and process operations. Cover blocked cleanup through the real API, await asynchronous removal in existing tests, and consolidate overlapping serial log coverage.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Clarify process capture cleanup and identity contracts

Document best-effort capture removal on resource deletion after process exit or confirmed absence, including PID reuse. Clarify the identity timestamp's use for subsequent persistent-process PID-reuse protection and retain the Linux since-boot distinction.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9

* Avoid resource-scoped loggers in queued exec cleanup

Use the controller logger with execution name and UID for asynchronous capture disposal so late cleanup errors cannot reopen released resource log sinks.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Require fixed persistent process ports and preserve evaluated stop recovery

Reject dynamically allocated persistent process ports regardless of lifecycle key, document the retained-process allocation limitation, and cover validation through the real API. Preserve evaluated launch configuration during ambiguous-create recovery when stop is requested.

Co-authored-by: Copilot App <[email protected]>

* Withdraw logical endpoints before backing cleanup and on terminal failure

Begin endpoint cleanup immediately on logical deletion without letting endpoint errors block backing deletion requests. Withdraw endpoints for missing or invalid process backings and invalid container backings, while retaining independent service lifetimes and existing finalization ordering.

Co-authored-by: Copilot App <[email protected]>

* Report confirmed runtime container absence as failed

Project Missing as Failed with RuntimeContainerMissing so logical containers and exec prerequisites reject confirmed absence through existing failure handling. Keep transient Unknown retryable and deletion completion independent of phase.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Select UDP backend socket family independently of frontend listener

Bind backend-facing UDP sockets using the resolved endpoint family so IPv4 and IPv6 frontends can reach either backend family. Preserve frontend reply identity and cover same-family, cross-family, and hostname forwarding.

Co-authored-by: Copilot App <[email protected]>

* Remove service modes and consolidate logical service configuration

Keep LogicalService focused on DCP-managed proxy and proxyless routing. Remove predefined-address mode and share the canonical LogicalServiceSpec directly with inline templates. External-backed service resources are deferred to a separate PR.

Co-authored-by: Copilot App <[email protected]>

* Share output preservation policy across resource capture cleanup

Honor DCP_PRESERVE_EXECUTABLE_LOGS in shared capture and path cleanup, including image acquisition and runtime-container log descriptors. Keep writer closure and explicit CaptureFile disposal independent of retention policy; cover preservation and normal removal with shared and real API regressions.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Report specific container exec preflight failure causes

Avoid formatting nil lookup errors for changed, deleting, or terminal targets. Preserve ContainerUnavailable handling and assert the resulting diagnostic through the real API.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Record shared Get telemetry for container exec reconcilers

Count successful, failed, and NotFound initial resource reads consistently with the other controllers.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Preserve proxy streams when logical service routes are unchanged

Cache successfully applied routing configuration while retaining listener health checks. Reset cached routes on listener replacement or configuration failure, and cover UDP stream retention plus TCP/UDP recovery through the real API.

Co-authored-by: Copilot App <[email protected]>

* Filter unchanged exec namespace and backing watch updates

Apply ResourceVersionChangedPredicate to namespace watches and logical exec's owned physical watch, matching established V2 controller registrations.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Use a shared resource-neutral exit code setter

Move setExitCode beside common status setters and update process and container exec callers without changing comparison or cloning behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Cover V2 container exec through real runtime integration

Add runtime-gated API/controller coverage using shared runtime discovery, resource tracking, and the container probe. Exercise inputs, output and exit results, attached execution deletion, target exit, and exited-target rejection. Real-runtime execution is reserved for enabled CI.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6

* Pin UDP backend peers and verify terminal template preparation semantics

Use connected UDP backend sockets with TCP-consistent source binding and preserved UDP hostname resolution. Cover cross-family TCP/UDP forwarding and unrelated-reply rejection. Keep fatal template preparation terminal, cover pending-versus-fatal Stop behavior, and make capability-dependent IPv6 tests portable.

Co-authored-by: Copilot App <[email protected]>

* Retain started service listeners without automatic replacement

Retry initial listener startup, but exclude stopped listeners without reallocating their frontend addresses. Preserve healthy listeners and retry configuration failures on the same listeners. Report partial and complete listener loss explicitly and cover listener retention, initial retries, and service recreation through the real API.

Co-authored-by: Copilot App <[email protected]>

* Validate consumer service references before template lookup

Reuse the existing same-namespace resource-reference validator so malformed template references fail preparation terminally without reaching the API reader. Preserve retry behavior for valid missing services and cover both consumer helpers, argument/environment values, and logical process/container preparation.

Co-authored-by: Copilot App <[email protected]>

* Use target-specific environment casing for logical templates

Pass an explicit ignoreEnvironmentCase boolean: containers preserve case-distinct names on every host and host processes fold names only on Windows. Preserve last-value-wins normalization before evaluation and cover both policies, template errors, physical configuration, and lifecycle hashes.

Co-authored-by: Copilot App <[email protected]>

* Enforce immutable V2 service endpoint specifications

Validate endpoint updates consistently with immutable V2 services and replace changed workload bindings through deletion and creation. Cover real-API update/patch rejection, finalizer cleanup, endpoint replacement identity, and validation hooks across persisted V2 resources.

Co-authored-by: Copilot App <[email protected]>

* Keep V2 lifecycle work in state-specific reconciliation handlers

Separate creation, running, stopping, terminal and unknown handling across logical and physical controllers. Preserve identity guards and ambiguous API-create confirmation while removing generation gates, inline phase handoffs, and result-handler recovery. Withdraw endpoints independently of stop completion, synchronize the complete owned endpoint set, and retain bounded worker retries without polling image readiness inside reconciliation.

Update lifecycle regressions and documentation. Full make lint passes on Windows, macOS and Linux; bounded native simulated real-API integration selections and controller unit races pass. Full test-suite execution remains for CI.

Co-authored-by: Copilot App <[email protected]>

* Name V2 condition reasons and repair reconciliation regressions

Define typed reason constants beside the relevant APIs, share common logical-resource and execution reasons, and preserve existing status strings across handlers, projections, and tests. Restore Stop transitions before backing lookup, keep missing pinned image backings Unknown, and add the physical container Resolve projection. Align backing/log assertions with the approved Unknown and diagnostic contracts and extend lookup-failure regression coverage.

Co-authored-by: Copilot App <[email protected]>

* Honor persistent Stop without enforcing desired lifecycle keys

Preserve desired lifecycle keys in logical status while adopting retained runtime identities for Stop. Keep persistent process record keys unchanged during adoption and cover mismatched keys and pending replacement handoff.

Co-authored-by: Copilot App <[email protected]>

* Quiesce terminal V2 reconciliation and release startup leases

Stop polling terminal services and retain their startup failure diagnostics. Release terminal logical startup leases independently of backing observations, dispatch preparation failure through terminal handling, and centralize owner-scoped container/image identity lookups.

Extend existing terminal regressions and remove the timing-dependent test that required an intermediate Pending-with-ID snapshot.

Co-authored-by: Copilot App <[email protected]>

* Slim V2 state and make preparation outcomes explicit

Retain effective launch values and handed-off port selections instead of whole configuration copies. Recover existing children before reevaluating inputs, reuse PersistentProcessRecord, and remove redundant image/service/network fields.

Return preparation errors explicitly, classify terminating or failed services through established preparation-failed states, share logical-to-physical container configuration mapping, and synchronize deletion tests on committed work rather than a reader-specific hook.

Co-authored-by: Copilot App <[email protected]>

* Normalize V2 API creation recovery and collision validation

Defer ambiguous API write recovery to reconciliation, validate exact AlreadyExists collisions, and fail incompatible service templates terminally.

Co-authored-by: Copilot App <[email protected]>

* Clean up V2 endpoints after logical workloads

Order namespace endpoint cleanup after logical processes and containers so live owners do not attempt to recreate withdrawn endpoints.

Co-authored-by: Copilot App <[email protected]>

* Align logical service watches and reconciliation bookkeeping

Filter redundant endpoint and namespace updates, honor canceled reconciliation contexts, and record standard Get outcome counters.

Co-authored-by: Copilot App <[email protected]>

* Preserve UDP flows after refusal and align V2 IPv6 addresses

Retain cross-family UDP flows across backend connection-refused errors with verbose diagnostics. Preserve V1 bracketed IPv6 representation through V2 service publication, endpoint derivation, and templates, using the shared formatter without capability-dependent formatting.

Co-authored-by: Copilot App <[email protected]>

* Gate initial workload readiness on endpoint publication

Keep initial startup Pending until endpoints and required container port mappings are available. Log and retry subsequent endpoint failures without changing workload lifecycle/readiness or classifying them as physical failures.

Co-authored-by: Copilot App <[email protected]>

* Expand V2 endpoint derivation and adoption coverage

Cover address normalization, port/protocol filtering, unpublished mappings, ordering and deduplication. Exercise existing-mode process and container endpoint publication, ownership, withdrawal, and retained runtime/service lifetimes.

Co-authored-by: Copilot App <[email protected]>

* Attribute container endpoints to fixed and ordered dynamic host ports

Match explicit host ports directly and assign remaining distinct host ports numerically to dynamic declarations in spec order per container-port/protocol pair. Preserve all addresses per selected binding and explicit aliases, with documentation and unit/integration coverage.

Co-authored-by: Copilot App <[email protected]>

* Correct UDP backend connection cleanup comment

Co-authored-by: Copilot App <[email protected]>

* Simplify V2 volume policy and preserve physical log completion

Flatten physical volumes into one create-or-reuse contract, remove replacement and reference-only options, and retain explicit cleanup policy. Preserve physical log completion independently of logical lifecycle, including output drain after exit.

Co-authored-by: Copilot App <[email protected]>

* Keep private test API servers alive through resource cleanup

Register lifetime cancellation as the earliest cleanup hook so namespace cleanup finishes before API server shutdown.

Co-authored-by: Copilot App <[email protected]>

* Scope V2 child discovery and deletion confirmation

Co-authored-by: Copilot App <[email protected]>

* Handle missing process readiness during stop failure

Co-authored-by: Copilot App <[email protected]>

* Preserve successful stop when runtime container disappears

Co-authored-by: Copilot App <[email protected]>

* Resolve local host addresses for explicit V2 family selectors

Co-authored-by: Copilot App <[email protected]>

* Remove unused logical process backing error sentinel

Co-authored-by: Copilot App <[email protected]>

* Compute endpoint publication data lazily and preserve terminal outcomes

Co-authored-by: Copilot App <[email protected]>

* Use shared container execution cancellation reason

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: bbe01c56-5ae4-4f36-8134-93b3b2718fd2
Copilot-Session: aa4abbe1-3392-4398-9f96-566f68ce0fa9
Copilot-Session: 89db152a-aa9d-4e1d-9058-d4c0090c88d6
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.

3 participants