Spawn-session terminal primary succession #79

Closed
opened 2026-10-12 14:17:45 +09:00 by dreampiler · 5 comments
Owner

Owner goal: Operations instruction delivered in this conversation, 2026-10-12 05:0xZ: when the current primary session is terminal (FAILED, CANCELLED, COMPLETED), a session created by spawn_session_kandev succeeds it as primary; a live primary keeps its role. Prevent messages and the preserved queue from remaining attached to a dead primary.
Observable result: one isolated stop -> spawn sequence creates a same-task replacement that is primary and receives the existing queued message; spawning while the primary is live creates a secondary and preserves the live primary.
This task owns only the terminal-primary succession in the existing spawn_session_kandev path and its existing primary/queue integration. One goal, one task, one PR. No new MCP tool, watchdog rule, generic session/recovery framework, other launch path, or broad queue lifecycle change.
Destination: fork-only-zero category1, a general upstream candidate. W091 alone receives/publishes the verified upstream preparation. Keep the fork delta as a temporary patch until upstream acceptance; this classification is not proof of merge/zero residuals. Include the source in the NEXT Operations replacement; installation, runtime/home/DB and interim ops_watch handling remain Operations-owned.
Operations source evidence is reported (not controller source inspection): fork51bcc0258a, apps/backend/internal/mcp/handlers/spawn_session.go creates sessions without changing primary; stop_task_kandev tells the parent to spawn after CANCELLED, while no primary-promotion MCP is available. Controller has directly observed these same-task recoveries. Verify current assigned source and existing owning contracts before changes; preserve useful existing work.
Use Standard workflow, configured dynamic profile35909ac3, assigned Worktree executor08eb0bba, fork main; no manually selected model/candidate order/ceiling. You are not alone. Use only the one Kandev-assigned worktree; never create a second copy, edit shared checkout, revert another writer, touch their session/queue, or force/reset.
Read owning root/scoped AGENTS and existing specs for MCP spawning/additional sessions, primary assignment and queued delivery. First produce the smallest English requirements/system-design/plan/work-order package or explicitly reuse sufficient existing requirement/design contracts; deliver the concrete reviewed checkpoint before production/permanent-test changes. No generic workflow envelope bypass, extra owner approval/model-switch or duplicate architectural inventory. Design card D:/260720_Ai_Workspace/projects/260926_Kandev/repo/_Prj_Knowledge/p200_index/설계카드.md:28-32 invariants3-5; design-index integration-design section2 ownership, architecture Orchestrator/Task and execution/session pointers. Do not weaken visible control/profile/worktree isolation.
Implementation after the design checkpoint: promote the successfully created same-task session only when the observed current primary is terminal at the assignment boundary. A live RUNNING/STARTING/WAITING primary stays primary. Preserve concurrent winner semantics using the existing repository/service mechanism; do not let two spawns overwrite a newly live primary or invent a parallel registry. Preserve current behavior for cases outside the explicit terminal-primary scope. Failed creation must not install a nonexistent session as primary. Retain messages and use the existing queue handoff mechanism, without deleting/reposting user messages or adding a watchdog.
Narrow companion units next to changed logic cover the terminal state set, live-primary preservation and relevant concurrent assignment/creation-failure boundaries. Reuse valid tests; no full-suite/E2E/CI/new recurring validator. ONE actual isolated stop -> spawn -> primary + queue-delivery proof, through the real supported entry path, on this same branch/offhome TEST via canonical scripts/dev-isolated.ps1 and own pidfile scripts/kandev-kill.ps1 -Yes (powershell -File). Never use the operating instance for stop/spawn/queue mutation, real paid providers, credentials or primary assignment. Keep current Windows six listener skips until merged4419 plus own-worktree inclusion; tunnel/plugin-fixture/portutil changed tests only, SKIP is not PASS.
Task08dd separately owns workflow-entry executor/canonical-environment attach and per-entry session creation. Task4bac owns child-attention queue routing/coalescing/idle lifecycle. Reuse existing helper contracts; report real overlapping source ownership before writing common files, but do not merge goals or silently move their scope here.
After authorized implementation: narrow checks -> fork commit/review/push/PR/merge, with explicit --repo dreampiler/kandev, no upstream write. Hand exact branch/base/head/delta, actual isolated primary/queue result and limits to parent and fixedOpus W0916f198197. Prepare a minimal upstream-portable delta without private routing policies; W091 alone publishes/records upstream. Distinguish source/fork merge from upstream acceptance and installed outcome. Next Operations replacement is included in this work goal; this worker does not install it.
Queue: KANDEV-SPAWN-PRIMARY-SUCCESSION-20261012. Use the existing gate report-progress only for this queue's jobsheet in reflection/cleanup; no direct AIWS source edits or new ledger. Preserve original required behavior while reducing fork-only residues.

Owner goal: Operations instruction delivered in this conversation, 2026-10-12 05:0xZ: when the current primary session is terminal (FAILED, CANCELLED, COMPLETED), a session created by spawn_session_kandev succeeds it as primary; a live primary keeps its role. Prevent messages and the preserved queue from remaining attached to a dead primary. Observable result: one isolated stop -> spawn sequence creates a same-task replacement that is primary and receives the existing queued message; spawning while the primary is live creates a secondary and preserves the live primary. This task owns only the terminal-primary succession in the existing spawn_session_kandev path and its existing primary/queue integration. One goal, one task, one PR. No new MCP tool, watchdog rule, generic session/recovery framework, other launch path, or broad queue lifecycle change. Destination: fork-only-zero category1, a general upstream candidate. W091 alone receives/publishes the verified upstream preparation. Keep the fork delta as a temporary patch until upstream acceptance; this classification is not proof of merge/zero residuals. Include the source in the NEXT Operations replacement; installation, runtime/home/DB and interim ops_watch handling remain Operations-owned. Operations source evidence is reported (not controller source inspection): fork51bcc0258a, apps/backend/internal/mcp/handlers/spawn_session.go creates sessions without changing primary; stop_task_kandev tells the parent to spawn after CANCELLED, while no primary-promotion MCP is available. Controller has directly observed these same-task recoveries. Verify current assigned source and existing owning contracts before changes; preserve useful existing work. Use Standard workflow, configured dynamic profile35909ac3, assigned Worktree executor08eb0bba, fork main; no manually selected model/candidate order/ceiling. You are not alone. Use only the one Kandev-assigned worktree; never create a second copy, edit shared checkout, revert another writer, touch their session/queue, or force/reset. Read owning root/scoped AGENTS and existing specs for MCP spawning/additional sessions, primary assignment and queued delivery. First produce the smallest English requirements/system-design/plan/work-order package or explicitly reuse sufficient existing requirement/design contracts; deliver the concrete reviewed checkpoint before production/permanent-test changes. No generic workflow envelope bypass, extra owner approval/model-switch or duplicate architectural inventory. Design card D:/260720_Ai_Workspace/projects/260926_Kandev/repo/_Prj_Knowledge/p200_index/설계카드.md:28-32 invariants3-5; design-index integration-design section2 ownership, architecture Orchestrator/Task and execution/session pointers. Do not weaken visible control/profile/worktree isolation. Implementation after the design checkpoint: promote the successfully created same-task session only when the observed current primary is terminal at the assignment boundary. A live RUNNING/STARTING/WAITING primary stays primary. Preserve concurrent winner semantics using the existing repository/service mechanism; do not let two spawns overwrite a newly live primary or invent a parallel registry. Preserve current behavior for cases outside the explicit terminal-primary scope. Failed creation must not install a nonexistent session as primary. Retain messages and use the existing queue handoff mechanism, without deleting/reposting user messages or adding a watchdog. Narrow companion units next to changed logic cover the terminal state set, live-primary preservation and relevant concurrent assignment/creation-failure boundaries. Reuse valid tests; no full-suite/E2E/CI/new recurring validator. ONE actual isolated stop -> spawn -> primary + queue-delivery proof, through the real supported entry path, on this same branch/offhome TEST via canonical scripts/dev-isolated.ps1 and own pidfile scripts/kandev-kill.ps1 -Yes (powershell -File). Never use the operating instance for stop/spawn/queue mutation, real paid providers, credentials or primary assignment. Keep current Windows six listener skips until merged4419 plus own-worktree inclusion; tunnel/plugin-fixture/portutil changed tests only, SKIP is not PASS. Task08dd separately owns workflow-entry executor/canonical-environment attach and per-entry session creation. Task4bac owns child-attention queue routing/coalescing/idle lifecycle. Reuse existing helper contracts; report real overlapping source ownership before writing common files, but do not merge goals or silently move their scope here. After authorized implementation: narrow checks -> fork commit/review/push/PR/merge, with explicit --repo dreampiler/kandev, no upstream write. Hand exact branch/base/head/delta, actual isolated primary/queue result and limits to parent and fixedOpus W0916f198197. Prepare a minimal upstream-portable delta without private routing policies; W091 alone publishes/records upstream. Distinguish source/fork merge from upstream acceptance and installed outcome. Next Operations replacement is included in this work goal; this worker does not install it. Queue: KANDEV-SPAWN-PRIMARY-SUCCESSION-20261012. Use the existing gate report-progress only for this queue's jobsheet in reflection/cleanup; no direct AIWS source edits or new ledger. Preserve original required behavior while reducing fork-only residues.
Author
Owner

probe2

probe2
Author
Owner

probe2

probe2
Author
Owner

Done: fork PR #244 merged to fork main (squash 16c48de58f, 2026-10-14T15:06:24Z; head 4a7dc4e07993fffedf1699341662ac87f8d5a459, reviewed). Spawn-session terminal-primary succession (REQ-TASKS-QUEUED-SESSION-OWNERSHIP-004): spawned session succeeds a terminal primary and receives its queue; live primary preserved; concurrent single-winner; fail-open. Narrow checks passed (go vet, repo CAS 4/4, orchestrator 6/6, MCP Spawn). Isolated proof DONE twice on the merged head via dev-isolated (backend :48429, mock-only): terminal succession PASS (successor primary + queue moved), live-primary PASS (primary kept, successor secondary). Remote branch deleted (--delete-branch); worktree clean, no worktree leftovers. Remaining: none in this task. Follow-up suggestion (for control): hand the verified delta (merge commit 16c48de58f on fork main; PR #244) to W091 for the upstream decision per the existing controller split; NEXT Operations replacement stays Operations-owned.

Done: fork PR #244 merged to fork main (squash 16c48de58f, 2026-10-14T15:06:24Z; head 4a7dc4e07993fffedf1699341662ac87f8d5a459, reviewed). Spawn-session terminal-primary succession (REQ-TASKS-QUEUED-SESSION-OWNERSHIP-004): spawned session succeeds a terminal primary and receives its queue; live primary preserved; concurrent single-winner; fail-open. Narrow checks passed (go vet, repo CAS 4/4, orchestrator 6/6, MCP Spawn). Isolated proof DONE twice on the merged head via dev-isolated (backend :48429, mock-only): terminal succession PASS (successor primary + queue moved), live-primary PASS (primary kept, successor secondary). Remote branch deleted (--delete-branch); worktree clean, no worktree leftovers. Remaining: none in this task. Follow-up suggestion (for control): hand the verified delta (merge commit 16c48de58f on fork main; PR #244) to W091 for the upstream decision per the existing controller split; NEXT Operations replacement stays Operations-owned.
Author
Owner

Done: fork PR #244 merged to fork main (squash 16c48de58f, 2026-10-14T15:06:24Z; head 4a7dc4e07993fffedf1699341662ac87f8d5a459, reviewed). Spawn-session terminal-primary succession (REQ-TASKS-QUEUED-SESSION-OWNERSHIP-004): spawned session succeeds a terminal primary and receives its queue; live primary preserved; concurrent single-winner; fail-open. Narrow checks passed (go vet, repo CAS 4/4, orchestrator 6/6, MCP Spawn). Isolated proof DONE twice on the merged head via dev-isolated (backend :48429, mock-only): terminal succession PASS (successor primary + queue moved), live-primary PASS (primary kept, successor secondary). Remote branch deleted (--delete-branch); worktree clean, no worktree leftovers. Remaining: none in this task. Follow-up suggestion (for control): hand the verified delta (merge commit 16c48de58f on fork main; PR #244) to W091 for the upstream decision per the existing controller split; NEXT Operations replacement stays Operations-owned.

Done: fork PR #244 merged to fork main (squash 16c48de58f, 2026-10-14T15:06:24Z; head 4a7dc4e07993fffedf1699341662ac87f8d5a459, reviewed). Spawn-session terminal-primary succession (REQ-TASKS-QUEUED-SESSION-OWNERSHIP-004): spawned session succeeds a terminal primary and receives its queue; live primary preserved; concurrent single-winner; fail-open. Narrow checks passed (go vet, repo CAS 4/4, orchestrator 6/6, MCP Spawn). Isolated proof DONE twice on the merged head via dev-isolated (backend :48429, mock-only): terminal succession PASS (successor primary + queue moved), live-primary PASS (primary kept, successor secondary). Remote branch deleted (--delete-branch); worktree clean, no worktree leftovers. Remaining: none in this task. Follow-up suggestion (for control): hand the verified delta (merge commit 16c48de58f on fork main; PR #244) to W091 for the upstream decision per the existing controller split; NEXT Operations replacement stays Operations-owned.
Author
Owner

Done: fork PR #244 merged to fork main (squash 16c48de58f, 2026-10-14T15:06:24Z; head 4a7dc4e07993fffedf1699341662ac87f8d5a459, reviewed). Spawn-session terminal-primary succession (REQ-TASKS-QUEUED-SESSION-OWNERSHIP-004): spawned session succeeds a terminal primary and receives its queue; live primary preserved; concurrent single-winner; fail-open. Narrow checks passed (go vet, repo CAS 4/4, orchestrator 6/6, MCP Spawn). Isolated proof DONE twice on the merged head via dev-isolated (backend :48429, mock-only): terminal succession PASS (successor primary + queue moved), live-primary PASS (primary kept, successor secondary). Remote branch deleted (--delete-branch); worktree clean, no worktree leftovers. Remaining: none in this task. Follow-up suggestion (for control): hand the verified delta (merge commit 16c48de58f on fork main; PR #244) to W091 for the upstream decision per the existing controller split; NEXT Operations replacement stays Operations-owned.

Done: fork PR #244 merged to fork main (squash 16c48de58f, 2026-10-14T15:06:24Z; head 4a7dc4e07993fffedf1699341662ac87f8d5a459, reviewed). Spawn-session terminal-primary succession (REQ-TASKS-QUEUED-SESSION-OWNERSHIP-004): spawned session succeeds a terminal primary and receives its queue; live primary preserved; concurrent single-winner; fail-open. Narrow checks passed (go vet, repo CAS 4/4, orchestrator 6/6, MCP Spawn). Isolated proof DONE twice on the merged head via dev-isolated (backend :48429, mock-only): terminal succession PASS (successor primary + queue moved), live-primary PASS (primary kept, successor secondary). Remote branch deleted (--delete-branch); worktree clean, no worktree leftovers. Remaining: none in this task. Follow-up suggestion (for control): hand the verified delta (merge commit 16c48de58f on fork main; PR #244) to W091 for the upstream decision per the existing controller split; NEXT Operations replacement stays Operations-owned.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dreampiler/kandev#79