Skip to content

fix: couple derived DING to agent lifecycle - #154

Merged
schickling merged 2 commits into
mainfrom
schickling-assistant/2026-08-03-149-ding-companion-lifecycle
Aug 3, 2026
Merged

fix: couple derived DING to agent lifecycle#154
schickling merged 2 commits into
mainfrom
schickling-assistant/2026-08-03-149-ding-companion-lifecycle

Conversation

@schickling-assistant

@schickling-assistant schickling-assistant commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

A compact agent's generated DING was reconciled as an independent sibling. After the canonical agent exhausted fail-mode restarts or became lifecycle-ineligible, the DING could remain running or be relaunched without a live target terminal.

Goal

Keep generated companions coupled to the canonical agent's eligibility and terminal lifecycle while preserving same-pass healthy startup, retirement, exact-task selection, and explicitly authored sibling independence.

Decisions

  • Carry the existing derived relationship into resolved launch targets; do not infer dependency from the task name, because an authored exec "ding" is independent.
  • Plan a generated companion only while the canonical agent is live or service-eligible. An adopt-only held agent suppresses a missing companion and stops an exact generated companion proved live.
  • Execute a launching canonical agent before its derived tasks. Start derived work only after the agent starts successfully, and stop exact live companions when canonical-agent restart, reap, or terminal parking makes the target unavailable.
  • A targeted dead or absent generated DING is held instead of broadening the exact-task operation to start its canonical agent. Live adoption and retirement stay available, and explicit siblings retain ordinary selected-task behavior.
  • Update the timeless supervision and Agent Spec contracts without changing requirements.

Verification

  • Independent verifier RED cases reproduced before the follow-up fix: failed canonical spawn/reap left report.torn_down empty, and selecting an absent generated DING left report.held empty.
  • CI=1 nix develop -c cargo test --test run failed_compact_agent -- --nocapture: 2 failure-seam tests passed after the fix.
  • CI=1 nix develop -c cargo test --test run selected_missing_derived_ding -- --nocapture: 1 exact-selector test passed after the fix.
  • CI=1 nix develop -c cargo test --test run --test invariants --test targeted_reconcile -- --nocapture --test-threads=2: all 37 supervision tests and the invariant-reference test passed; the two CLI-only targeted tests also passed. The unchanged real-PTY test reported restarted (1) where its fixture expects launched (1).
  • CI=1 nix develop -c cargo test --test targeted_reconcile targeted_once_cli_ -- --nocapture --test-threads=1: 2 bounded targeted CLI tests passed.
  • Earlier branch-wide CI=1 CARGO_BUILD_JOBS=2 nix develop -c cargo test --all-targets --all-features -- --test-threads=2: all targets before materialize passed; up_materialize_only_writes_the_overlay_without_needing_pty failed because its fixed /usr/bin:/bin PATH cannot run git rev-parse in the Nix shell. The exact isolated test fails identically on clean origin/main at 509ffb4, and the materialization implementation/tests are unchanged by this PR.
  • Earlier branch-wide cargo clippy --all-targets --all-features -- -D warnings reached the repository but failed on eight unchanged baseline warnings: agent_author.rs:311 and :729 (too_many_arguments), agent_publish.rs:393 (needless_borrows_for_generic_args), catalog_lock.rs:231 (let_and_return), catalog_transaction.rs:1195 (needless_borrow) and :1778 (too_many_arguments), eval_run.rs:521 (too_many_arguments), and message.rs:835 (too_many_arguments).

Complexity

No new module or dependency. The planner carries the authored derived bit plus exact live-derived IDs so execution can make dependency-aware decisions without guessing from names or re-observing runtime state.

Concerns

Draft PR #135 overlaps src/reconcile.rs, src/run.rs, and shared documentation on a different stacked base. If that stack resumes, one side will need a semantic rebase around launch planning.

Friction & bottlenecks

  • The current rustfmt reformatted 27 files; all unrelated formatting churn was reverted before commit.
  • The shared build environment was heavily CPU/swap constrained, so broad verification was capped at two build jobs and two test threads.
  • The repository-wide clippy, materialize, and real-PTY targeted failures above are unchanged and recorded rather than repaired out of scope.

Follow-ups

References

Closes #149
Related: #135

agent-tool: Codex
agent-tool-version: 0.145.0
agent-runtime: Codex 0.145.0
agent-session-lookup: unavailable
tooling-profile: dotfiles@unknown-dirty
agent-tool: Codex
agent-tool-version: 0.145.0
agent-runtime: Codex 0.145.0
agent-session-lookup: unavailable
tooling-profile: dotfiles@unknown-dirty
@schickling-assistant
schickling-assistant marked this pull request as ready for review August 3, 2026 14:15
@schickling
schickling merged commit 8d9cd99 into main Aug 3, 2026
1 check passed
@schickling schickling added area:ding DING delivery: inbox notice into a running agent · Set: manual area:reconcile Supervisor run loop, lifecycle, restart, park, and teardown · Set: manual origin:agent Filed or primarily produced by an AI agent · Set: manual type:bug Something broken or a regression · Set: manual labels Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ding DING delivery: inbox notice into a running agent · Set: manual area:reconcile Supervisor run loop, lifecycle, restart, park, and teardown · Set: manual origin:agent Filed or primarily produced by an AI agent · Set: manual type:bug Something broken or a regression · Set: manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Derived DING task can remain running after its managed agent task becomes terminal

2 participants