Skip to content

feat(delegation): continue_with_session and hide sub-sessions by default - #375

Open
hkx1997 wants to merge 3 commits into
xintaofei:mainfrom
hkx1997:feat/delegation-continue-session-clean
Open

feat(delegation): continue_with_session and hide sub-sessions by default#375
hkx1997 wants to merge 3 commits into
xintaofei:mainfrom
hkx1997:feat/delegation-continue-session-clean

Conversation

@hkx1997

@hkx1997 hkx1997 commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Multi-agent continue_with_session / close_session, plus sidebar treatment of delegated sub-sessions — no file-path context-menu changes.

Backend (codeg-mcp + broker)

  • New MCP tools: continue_with_session, close_session
  • Completed/failed children stay alive for reuse; cancel/close still tear down
  • Resume via external_id when the child process is gone
  • Same task_id for status/cancel after continue

Sidebar

  • Root list never shows delegation children (parent_id / kind=delegate / delegation_call_id)
  • Funnel toggle Show delegated sub-sessions (default off)
  • Sub badge uses DB markers only (not UI depth, so worktree indent is not mislabeled)
  • Parent shows an N sub hint when trees are hidden

Sub-agent dialog

  • Multi-turn timeline: while a continue turn streams, only the current reply partial is hidden; prior history stays

Test plan

  • pnpm exec vitest run src/lib/conversation-sidebar.test.ts src/lib/adapters/tool-kind-classifier.test.ts src/contexts/conversation-runtime-context.test.tsx (94 passed)
  • cargo check --manifest-path src-tauri/Cargo.toml --features test-utils --lib
  • ESLint on key frontend files (after prettier)
  • Manual: funnel default hides sub-trees; enable + expand shows real Sub rows only
  • Manual: delegate → wait for transcript → cancel → continue → dialog keeps prior turns

@hkx1997
hkx1997 force-pushed the feat/delegation-continue-session-clean branch from 0edfcd6 to 6108844 Compare July 23, 2026 15:58
hkx1997 added 3 commits July 25, 2026 23:25
…efault

Add continue_with_session/close_session MCP tools so parent agents can resume
a failed or completed child without cold re-delegation. Keep completed/failed
children alive for resume, re-spawn via external_id when needed, and fix the
sub-agent dialog timeline to preserve multi-turn history during continue.

Sidebar: filter out delegation children from root lists
(parent_id/kind/delegation_call_id), add a funnel toggle for showing
sub-session trees (default off), and label sub-session rows when expanded.
@hkx1997
hkx1997 force-pushed the feat/delegation-continue-session-clean branch from 820196d to 4d6e409 Compare July 25, 2026 15:25
7iook pushed a commit to 7iook/codeg that referenced this pull request Jul 26, 2026
Replace the v1 one-shot delegation lifecycle (child torn down at first
terminal state, broker.rs "v1 one-shot" comment) with continuable
sessions shared between the parent LLM and the user.

Backend:
- Session/Turn/Operation three-layer split inside the broker; the
  completed cache now only caches result text (evicting it can no
  longer change domain behavior)
- continue_with_session / close_session MCP tools (wire-compatible
  with upstream PR xintaofei#375; close is release semantics, session_released
  with session_closed accepted as a historical alias)
- Keep-alive with kept_alive_cap (global + per-parent FIFO) on top of
  idle-sweep reclamation; resume via external_id with triple binding
  checks (agent_type/folder/uniqueness) and pre-side-effect
  resume_unavailable instead of silent session/new downgrade
- Startup rebuild protocol (rebuilding retryable state, per-row
  failure isolation, ledger not reused across restarts)
- Continuation registered cancellable before the follow-up prompt is
  sent (closes the register-window cancel race), close-vs-continue
  serialization hardened at the settle_session choke point
- update_external_id resume-safe/skip-delegate guards at all four
  call sites so a degraded session/new can never overwrite the resume
  credential of a delegate row
- session-scoped delegation_session_update event (task_id, turn_id,
  turn_version, origin); no duplicate completion against an
  already-terminal parent_tool_use_id

User entry point (not present in upstream PR xintaofei#375):
- continue/close/availability HTTP + Tauri commands keyed by
  conversation id, continuation_id idempotency ledger across all
  three entries (MCP arm included, listener never mints ids)
- Sub-agent dialog composer gated by five-state continuation
  availability; errors surfaced with stable codes
- Sidebar discoverability: Sub badge, sub-session filter toggle
  (default off), delegate rows excluded from the root list by DB
  markers only (immune to worktree indentation)
- Multi-turn timeline: prefix cut anchored to the in-flight user turn
  so earlier completed turns stay visible while a new turn streams

Verification: rust --lib 1805 passed / clippy -D warnings clean /
frontend vitest 2835 passed / tsc clean. Independent read-only review
(heterogeneous model) returned 0 critical; both important findings
(close-vs-continue compound-failure leak, unguarded external_id call
sites) fixed with red-green tests in this change.

Spec: docs/specs/delegation-continue-session/{requirements,design,tasks}.md
(3-round codex cross-review converged; introspection archived)
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.

1 participant