You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Separate the long-lived Agent Org Group Chat Conversation from one bounded Agent Org Run so users can keep asking questions after a terminal result and can explicitly start a new, idempotent Follow-up Run for additional work.
Completed continues to mean “this work round is finished.” It no longer means “this Conversation is permanently closed.”
Current develop behavior
The current Group Chat send path persists the user's message as a Run-scoped AgentInbox row. It correctly accepts only running or paused Runs. A terminal Run therefore returns:
terminal runs do not accept new group messages
That protects Run finality, but it also disables ordinary post-result questions.
Current develop provides important foundations:
root_session_id is indexed and can anchor sequential Run history;
session_turn_intents.org_run_id gives active turns exact writable Run ownership;
Group Chat user-message history is durable and cursor-paged;
terminal finality, Inbox delivery, Wake, Recovery, and deletion are guarded.
One important gap remains: Worker Session ownership is still largely resolved through a parent-session walk. Reusing one Root Coordinator Session for multiple Runs without an exact Run-to-Worker-Session mapping could attach an old Worker to the newest Run.
Product model
Concept
Meaning
Lifetime
Conversation
The long-lived Group Chat and transcript
until archive/delete
Root Coordinator Session
Conversation identity, transcript, and Coordinator continuity
same as Conversation
Agent Org Run
One bounded round of coordinated work
start to terminal result
Worker Session
One member's execution process for one exact Run
never reused across Runs
AgentInbox
Work input for Agents inside one active Run
strictly Run-scoped
Follow-up proposal
Durable suggestion to start another work round
pending to accepted/dismissed/stale
The first implementation uses the existing Root Coordinator Session as conversation_id. It does not add a duplicate Conversation transcript table. The Root Session transcript owns long-lived user/Coordinator dialogue; AgentInbox remains active Run delivery only.
Behavior after a terminal Run
Path A — ask a question
Persist the message in the Root Coordinator Session transcript, not the terminal Run Inbox.
Start one Coordinator turn in explicit post-completion read-only mode.
Provide bounded Run summary, Task summaries, output handles, Plan summary, and recent Conversation history.
Allow detail reads such as task_get and Plan detail on demand.
Return the answer without creating Tasks, writing old Inbox rows, waking old Workers, changing budgets, or mutating the source Run.
The first version routes post-completion @Reviewer and other historical member questions through the Coordinator using persisted results. Old Worker Sessions are never implicitly revived.
Path B — request additional work
The same Coordinator turn decides that execution is needed; no extra classification-model call is added.
Persist a structured Follow-up proposal with goal, rationale, and optional bounded task outline.
Show a confirmation card. Do not start Workers yet.
On confirmation, call idempotent org_follow_up_start.
Create a new Run linked to the source Run, with fresh Tasks, Plans, Inbox, Recovery state, and Worker Sessions.
Reuse the long-lived Root Coordinator Session while binding every active turn and Worker to the exact new Run.
Confirmation is the default to prevent accidental team token spend. Automatic start may be considered later as an explicit user setting.
Persistence and ownership
Run lineage and one-live-Run invariant
Add or normalize equivalent fields:
continued_from_run_id
originating_message_id
a unique idempotency index per Root Conversation
a partial unique index allowing at most one running or paused Run per Root Conversation
Existing databases must be audited for duplicate live Runs before enabling the unique index. Migration must not silently terminalize user data.
Exact Run-to-Session mapping
Add a canonical agent_org_run_sessions mapping with:
org_run_id
member_id
session_id
coordinator/worker role
creation timestamp
unique member and session identity within a Run
Resolution order:
exact session_turn_intents.org_run_id for an active turn;
exact Run Session mapping for Worker Sessions;
the one live Run or selected newest historical Run for the shared Root Coordinator Session;
parent walk only as a bounded legacy fallback that never overrides exact ownership.
The Root Coordinator Session may participate in sequential Runs. Worker Sessions belong to exactly one Run and are always recreated for a Follow-up Run.
Conversation-turn scope
Do not overload writable org_run_id as read-only history context. Extend the turn-intent contract with an explicit mode and optional reference_run_id:
agent_org_run_work: writable active Run ownership;
agent_org_post_completion: no writable Run, optional historical reference;
ordinary non-Agent-Org turns remain unchanged.
Mutation attempts in post-completion mode return a structured follow_up_run_required outcome instead of a red generic failure.
Durable proposal
Persist a bounded agent_org_follow_up_proposals record with Conversation Session, source Run, originating message, status, goal, proposal payload, timestamps, and optional created Run. Duplicate message/retry returns the existing proposal or Run.
org_follow_up_start
Within one SQLite writer transaction:
load the proposal and terminal source Run;
verify the Conversation exists and is not archived;
verify no other live Run exists;
coalesce a previously successful idempotency key;
snapshot the current Agent Org definition;
create the new Run and lineage;
create exact Coordinator/Worker Run Session ownership rows;
persist the confirmed new-Run goal;
accept the proposal and record the created Run;
commit.
Wake and provider calls occur after commit. A post-commit Wake failure leaves a valid recoverable Run and must not encourage a duplicate retry.
If Session materialization cannot participate in the same database transaction, use a truthful durable starting state with idempotent recovery. Do not claim atomicity across external effects or delete useful recovery evidence.
Coordinator authority after completion
Allowed:
read source Run Summary, Tasks, TaskOutput, Plan, and bounded Conversation history;
explain results;
create or update a Follow-up proposal;
start a Follow-up only under the configured confirmation policy.
Forbidden:
reopen or mutate the terminal source Run;
update old Tasks or write old Inbox rows;
wake old Workers;
clear completed_at or consume old recovery budget;
attach an old Worker to a new Run through parent walking.
UI behavior
Keep the input enabled after Completed, Failed, Cancelled, or Abandoned.
Show a neutral banner: This work round is complete. Ask a question or start follow-up work.
Render ordinary answers in the same Conversation transcript.
Render a durable Follow-up proposal card with confirm, edit, dismiss, loading, stale, conflict, and recovery states.
Show Run timeline boundaries and allow read-only historical selection.
Scope Team Tasks, Plan, Kanban, and Monitor to exactly one selected Run; never merge boards across Runs.
Only archiving the Conversation makes the input read-only.
Token and performance policy
no separate model call only to classify the message;
no old Worker Wake for historical questions;
bounded recent Conversation and Run summaries by default;
full outputs and Plans loaded only on demand;
no per-Run-card or per-member poller;
no unbounded Run timeline, proposal, transcript, or output arrays;
hidden and terminal views introduce no new background model or recovery work.
Delivery plan
Phase 1 — identity and exact ownership
Add lineage, idempotency, exact Run Session mapping, one-live-Run invariant, migration, and bounded Run timeline.
Make active execution prefer exact Turn/Session ownership over parent walking.
This feature can ship using the current Snapshot plus invalidation design. If #634 lands later, Revision Events remain scoped to one exact Run, while Conversation UI separately projects Run-start, Run-terminal, and proposal boundaries. The two features are complementary but must not become one event-sourced rewrite.
Summary
Separate the long-lived Agent Org Group Chat Conversation from one bounded Agent Org Run so users can keep asking questions after a terminal result and can explicitly start a new, idempotent Follow-up Run for additional work.
Completedcontinues to mean “this work round is finished.” It no longer means “this Conversation is permanently closed.”Current
developbehaviorThe current Group Chat send path persists the user's message as a Run-scoped
AgentInboxrow. It correctly accepts onlyrunningorpausedRuns. A terminal Run therefore returns:That protects Run finality, but it also disables ordinary post-result questions.
Current
developprovides important foundations:root_session_idis indexed and can anchor sequential Run history;session_turn_intents.org_run_idgives active turns exact writable Run ownership;One important gap remains: Worker Session ownership is still largely resolved through a parent-session walk. Reusing one Root Coordinator Session for multiple Runs without an exact Run-to-Worker-Session mapping could attach an old Worker to the newest Run.
Product model
The first implementation uses the existing Root Coordinator Session as
conversation_id. It does not add a duplicate Conversation transcript table. The Root Session transcript owns long-lived user/Coordinator dialogue; AgentInbox remains active Run delivery only.Behavior after a terminal Run
Path A — ask a question
task_getand Plan detail on demand.The first version routes post-completion
@Reviewerand other historical member questions through the Coordinator using persisted results. Old Worker Sessions are never implicitly revived.Path B — request additional work
org_follow_up_start.Confirmation is the default to prevent accidental team token spend. Automatic start may be considered later as an explicit user setting.
Persistence and ownership
Run lineage and one-live-Run invariant
Add or normalize equivalent fields:
continued_from_run_idoriginating_message_idrunningorpausedRun per Root ConversationExisting databases must be audited for duplicate live Runs before enabling the unique index. Migration must not silently terminalize user data.
Exact Run-to-Session mapping
Add a canonical
agent_org_run_sessionsmapping with:org_run_idmember_idsession_idResolution order:
session_turn_intents.org_run_idfor an active turn;The Root Coordinator Session may participate in sequential Runs. Worker Sessions belong to exactly one Run and are always recreated for a Follow-up Run.
Conversation-turn scope
Do not overload writable
org_run_idas read-only history context. Extend the turn-intent contract with an explicit mode and optionalreference_run_id:agent_org_run_work: writable active Run ownership;agent_org_post_completion: no writable Run, optional historical reference;Mutation attempts in post-completion mode return a structured
follow_up_run_requiredoutcome instead of a red generic failure.Durable proposal
Persist a bounded
agent_org_follow_up_proposalsrecord with Conversation Session, source Run, originating message, status, goal, proposal payload, timestamps, and optional created Run. Duplicate message/retry returns the existing proposal or Run.org_follow_up_startWithin one SQLite writer transaction:
Wake and provider calls occur after commit. A post-commit Wake failure leaves a valid recoverable Run and must not encourage a duplicate retry.
If Session materialization cannot participate in the same database transaction, use a truthful durable
startingstate with idempotent recovery. Do not claim atomicity across external effects or delete useful recovery evidence.Coordinator authority after completion
Allowed:
Forbidden:
completed_ator consume old recovery budget;UI behavior
Token and performance policy
Delivery plan
Phase 1 — identity and exact ownership
Phase 2 — post-completion read-only Coordinator turns
Phase 3 — durable proposal and Follow-up launch
Phase 4 — complete UI and restart behavior
Phase 5 — migration and production hardening
Non-goals
Acceptance criteria
Relationship to #634
This feature can ship using the current Snapshot plus invalidation design. If #634 lands later, Revision Events remain scoped to one exact Run, while Conversation UI separately projects Run-start, Run-terminal, and proposal boundaries. The two features are complementary but must not become one event-sourced rewrite.
Design document
Updated design:
docs/architecture-audit-2026-08-01/AgentOrgPostCompletionConversationAndFollowUpRuns.md.