Add Todo discussion planning and Goal handoff - #8
Conversation
Introduce the dedicated Discussion agent and Plan workflow skills. Route Todo planning and Start Work handoff through durable Sessions while keeping Goal optional, and cover the behavior across runtime, server, Web, architecture tests, and documentation.
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughChangesDiscussion agent and session identity
Todo board and feedback behavior
Documentation and validation
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
All reported issues were addressed across 79 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (4)
apps/web/src/routes/project-todos.tsx (1)
97-99: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winShare the plan command string instead of duplicating it.
planWorkCommandrestates the exact command thatsessionMessagebuilds inpackages/agent-core/src/todos/service.ts(lines 145-180), and it hardcodes.archcode/plans/while the server derives the path fromPROJECT_STATE_DIR_NAME. If either the wording or the state directory changes, the reused-Discussion path and the new-Discussion path diverge silently. Move the command builder and the plans path into@archcode/protocoland consume it from both sides.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/routes/project-todos.tsx` around lines 97 - 99, Move the shared plan-work command builder and plans-directory path constant into `@archcode/protocol`, then update planWorkCommand in project-todos.tsx and sessionMessage in the todos service to consume them. Remove the duplicated command wording and hardcoded .archcode/plans/ path while preserving the existing todoId substitution and behavior.packages/agent-core/src/todos/schema.ts (2)
14-27: 📐 Maintainability & Code Quality | 🔵 TrivialCanonical schema duplicated in
apps/server/src/routes/todos.ts.
CreateProjectTodoSessionSchemahere is the schema the service actually parses against.apps/server/src/routes/todos.tsredefines an identical schema and superRefine rule. See the consolidated comment for the shared fix.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/agent-core/src/todos/schema.ts` around lines 14 - 27, Use the canonical CreateProjectTodoSessionSchema from packages/agent-core instead of maintaining a duplicate definition in apps/server/src/routes/todos.ts. Remove the route-local schema and its superRefine rule, then import and reuse the shared schema so parsing and validation remain identical.
1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate
initialIntent/entryvalidation rule across the HTTP and service layers. Both files define the same fields, the samez.literal("plan").optional()constraint, and the identical superRefine message restrictinginitialIntentto Discussion Sessions. The rule is defined twice instead of shared, risking drift if one copy changes without the other.
packages/agent-core/src/todos/schema.ts#L14-27: keep this as the single source of truth; exportCreateProjectTodoSessionSchema(or its shape) from the package's public surface.apps/server/src/routes/todos.ts#L47-59: replace the locally redefinedCreateProjectTodoSessionBodySchemawith an import of the schema frompackages/agent-core/src/todos/schema.ts, instead of re-declaring the same fields and superRefine rule.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/agent-core/src/todos/schema.ts` at line 1, Make the todo session validation in packages/agent-core/src/todos/schema.ts the single source of truth by exporting CreateProjectTodoSessionSchema or its shape through the package’s public API. In the server route’s CreateProjectTodoSessionBodySchema usage, import and reuse that exported schema instead of locally redefining the fields and superRefine rule, preserving the existing validation behavior.apps/server/src/routes/todos.ts (1)
47-59: 📐 Maintainability & Code Quality | 🔵 TrivialDuplicate validation logic with
packages/agent-core/src/todos/schema.ts.This schema repeats the same
entry/initialIntentshape and superRefine rule, including the exact error message, thatCreateProjectTodoSessionSchemainpackages/agent-core/src/todos/schema.tsalready defines. See the consolidated comment for the shared fix.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/server/src/routes/todos.ts` around lines 47 - 59, Replace the locally defined CreateProjectTodoSessionBodySchema validation in the todos route with the shared CreateProjectTodoSessionSchema from packages/agent-core/src/todos/schema.ts, reusing its entry/initialIntent shape and refinement instead of duplicating the rule. Preserve the route’s expectedRevision validation and existing request parsing behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@AGENTS.md`:
- Around line 460-462: Update the Plan-generation documentation in AGENTS.md
lines 460-462 and docs/concepts.md lines 55-62 to specify that the latest
Discussion is reused only when idle; running, HITL-suspended, deleted, or newly
busy Sessions require creating a new Plan Discussion. Preserve the rule that a
newly created Discussion receives the Plan request as its first accepted message
and that generation uses the single deterministic .archcode/plans/<todo-id>.md
path.
In `@apps/web/src/routes/project-todos.tsx`:
- Around line 149-155: Update isUnavailablePlanDiscussion so the 404 fallback
returns true only when cause.code equals "SESSION_NOT_FOUND"; preserve the
existing 409 scopeCode handling. Update the stale-session test to use
SESSION_NOT_FOUND rather than treating every 404 as an unavailable plan
discussion.
In `@packages/agent-core/src/store/session-store-manager.ts`:
- Around line 203-211: Strengthen session identity validation so non-root agents
require a parentSessionId and child sessions cannot provide their own
rootSessionId. Apply the same checks in session-store-manager.ts at the session
creation guard and helpers.ts during persisted Session validation, then add
tests covering both invalid combinations.
---
Nitpick comments:
In `@apps/server/src/routes/todos.ts`:
- Around line 47-59: Replace the locally defined
CreateProjectTodoSessionBodySchema validation in the todos route with the shared
CreateProjectTodoSessionSchema from packages/agent-core/src/todos/schema.ts,
reusing its entry/initialIntent shape and refinement instead of duplicating the
rule. Preserve the route’s expectedRevision validation and existing request
parsing behavior.
In `@apps/web/src/routes/project-todos.tsx`:
- Around line 97-99: Move the shared plan-work command builder and
plans-directory path constant into `@archcode/protocol`, then update
planWorkCommand in project-todos.tsx and sessionMessage in the todos service to
consume them. Remove the duplicated command wording and hardcoded
.archcode/plans/ path while preserving the existing todoId substitution and
behavior.
In `@packages/agent-core/src/todos/schema.ts`:
- Around line 14-27: Use the canonical CreateProjectTodoSessionSchema from
packages/agent-core instead of maintaining a duplicate definition in
apps/server/src/routes/todos.ts. Remove the route-local schema and its
superRefine rule, then import and reuse the shared schema so parsing and
validation remain identical.
- Line 1: Make the todo session validation in
packages/agent-core/src/todos/schema.ts the single source of truth by exporting
CreateProjectTodoSessionSchema or its shape through the package’s public API. In
the server route’s CreateProjectTodoSessionBodySchema usage, import and reuse
that exported schema instead of locally redefining the fields and superRefine
rule, preserving the existing validation behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ee6911ad-624b-408c-b9e9-8394feb21df2
📒 Files selected for processing (79)
AGENTS.mdREADME.mdapps/server/src/routes/attachment-http-error.tsapps/server/src/routes/messages.test.tsapps/server/src/routes/messages.tsapps/server/src/routes/sessions.test.tsapps/server/src/routes/todos.test.tsapps/server/src/routes/todos.tsapps/web/src/components/composite/ToolCard.test.tsxapps/web/src/components/composite/ToolCard.tsxapps/web/src/lib/agent-constants.test.tsapps/web/src/lib/agent-constants.tsapps/web/src/routes/project-todos.interaction.tsxapps/web/src/routes/project-todos.test.tsxapps/web/src/routes/project-todos.tsxapps/web/src/routes/root-layout.interaction.tsxapps/web/src/routes/root-layout.tsxdesign-system/MASTER.mddesign-system/pages/todos.mddesign-system/prototypes/todos.htmldocs/agents/multi-agent-design.mddocs/concepts.mddocs/configuration.mddocs/goals/todo-discussion-plan-execution-hard-cut-plan-goal.mddocs/goals/todo-discussion-plan-execution-hard-cut-progress.mdpackages/agent-core/src/__arch__/goal-boundaries.test.tspackages/agent-core/src/__arch__/tool-output-policy-matrix.test.tspackages/agent-core/src/agents/configured-agent.test.tspackages/agent-core/src/agents/configured-agent.tspackages/agent-core/src/agents/definitions/definitions.test.tspackages/agent-core/src/agents/definitions/discussion.tspackages/agent-core/src/agents/definitions/index.tspackages/agent-core/src/agents/definitions/lead.tspackages/agent-core/src/agents/definitions/role-contracts.tspackages/agent-core/src/agents/errors.tspackages/agent-core/src/agents/factory.test.tspackages/agent-core/src/agents/index.tspackages/agent-core/src/agents/names.tspackages/agent-core/src/agents/root-session-identity.tspackages/agent-core/src/agents/session-profile.tspackages/agent-core/src/commands/registry.test.tspackages/agent-core/src/commands/registry.tspackages/agent-core/src/delegation/contract.test.tspackages/agent-core/src/execution/session-execution-manager.test.tspackages/agent-core/src/execution/session-execution-manager.tspackages/agent-core/src/lead-architecture-flows.integration.test.tspackages/agent-core/src/main.test.tspackages/agent-core/src/prompt/compiler.test.tspackages/agent-core/src/prompt/lint.tspackages/agent-core/src/runtime-automations.test.tspackages/agent-core/src/runtime.tspackages/agent-core/src/session-goal/service.test.tspackages/agent-core/src/session-input/model-selection-service.tspackages/agent-core/src/session-input/model-selection.test.tspackages/agent-core/src/skills/builtin/execute-plan/SKILL.mdpackages/agent-core/src/skills/builtin/manifest.tspackages/agent-core/src/skills/builtin/plan-work/SKILL.mdpackages/agent-core/src/skills/builtin/shape-todo/SKILL.mdpackages/agent-core/src/skills/service.test.tspackages/agent-core/src/skills/service.tspackages/agent-core/src/store/helpers.test.tspackages/agent-core/src/store/helpers.tspackages/agent-core/src/store/session-store-manager.test.tspackages/agent-core/src/store/session-store-manager.tspackages/agent-core/src/store/types.tspackages/agent-core/src/todos/schema.tspackages/agent-core/src/todos/service.test.tspackages/agent-core/src/todos/service.tspackages/agent-core/src/tools/builtins/automation-create.test.tspackages/agent-core/src/tools/builtins/automation-create.tspackages/agent-core/src/tools/builtins/model-visible-contract.test.tspackages/agent-core/src/tools/builtins/project-todo-update.test.tspackages/agent-core/src/tools/builtins/project-todo-update.tspackages/agent-core/src/tools/builtins/session-goal.test.tspackages/agent-core/src/tools/builtins/session-goal.tspackages/agent-core/src/tools/builtins/worktree.tspackages/protocol/src/model-runtime.tspackages/protocol/src/project-todos.tspackages/protocol/src/types.ts
💤 Files with no reviewable changes (2)
- packages/agent-core/src/tools/builtins/session-goal.ts
- packages/agent-core/src/tools/builtins/worktree.ts
There was a problem hiding this comment.
All reported issues were addressed across 23 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Summary
discussionas a dedicated root Agent identity for shaping a bound Todo without starting implementation.archcode/plans/<todo-id>.md, includingplan-workandexecute-planSkillsGenerate / Improve PlanTodo action, grouped drawer actions, pointer-first drag targeting, and resilient handling for busy or stale DiscussionsStart Workand Goal orthogonal: a Plan changes the initial Lead handoff, while Goal creation remains an explicit user choiceWhy
Todo, Plan, and Goal previously lacked a clear product and runtime boundary. This change makes Discussion a formal identity, keeps Plan as ordinary Markdown, and reuses the existing Lead/Goal execution protocol without adding a Plan service, state machine, compatibility layer, or automatic Goal creation.
Validation
bun run typecheckbun run testbun run buildgit diff --checksol(xhigh)architecture review: approvedSummary by CodeRabbit
New Features
Bug Fixes