fix(review): restore CodeReview/DeepReview session creation and turns - #2106
Conversation
Review child sessions are created with agentType=CodeReview (standard) or DeepReview (strict), but resolve_primary_agent_for_turn only accepted Mode-category agents, so session creation failed with "Unknown session mode: CodeReview" and persisted review sessions could be silently rewritten to agentic on restore. Allow the builtin CodeReview/DeepReview agents to resolve as local session primaries while keeping all other subagents restricted, and add diagnostics at the rejection point. Regression introduced by ca94825.
limityan
left a comment
There was a problem hiding this comment.
resolve_primary_agent_for_turn 的修复目前只覆盖了无 workspace external route 时的 fallback 分支。命中 ExternalSubagentRoute::Local 时(external.rs 约 439–442 行),代码仍只接受 AgentCategory::Mode,而内置 CodeReview / DeepReview 并非 Mode,因此显式选择 Local route 的 workspace 仍可能在创建、恢复或启动 review session 时失败。
建议提取统一的 local session-primary 判定,并同时用于 ExternalSubagentRoute::Local 与 fallback 两个分支;另外增加安装 CodeReview -> Local route 后仍能成功解析的测试。
…t ids Introduce CODE_REVIEW_AGENT_TYPE in agent-runtime deep_review constants and use it in registry review-entry detection and session-primary resolution, replacing the scattered "CodeReview" magic string. This keeps review agent ids consistent with the existing DEEP_REVIEW_AGENT_TYPE / REVIEW_JUDGE_AGENT_TYPE constants. This cleanup also served as the verification content for the /review session fix in this PR: it was written into the workspace and reviewed end-to-end with the /review command after installing the fixed build, confirming review sessions now create and run correctly.
…n primaries resolve_primary_agent_for_turn still filtered the ExternalSubagentRoute::Local branch to AgentCategory::Mode, so workspaces whose route table pins CodeReview/DeepReview to the local implementation (same-name conflict resolved to the local candidate) could still fail to create, restore, or start review sessions. Extract a shared is_local_session_primary_entry predicate used by both the explicit Local-route branch and the no-route fallback, and add a diagnostic warn when a registered entry is rejected under a Local route.
|
Thanks for the review — you are right. The fix only covered the no-route fallback; the \ExternalSubagentRoute::Local\ branch (workspaces where a same-name conflict was explicitly resolved to the local candidate) still filtered to \AgentCategory::Mode\ and would reject CodeReview/DeepReview. Addressed in \c02740ad3:
Registry suite: 34 passed (33 existing + 1 new). \cargo check -p bitfun-core --no-default-features\ clean. |
limityan
left a comment
There was a problem hiding this comment.
已重新审核最新提交。
上次提出的问题已修复:
ExternalSubagentRoute::Local与无路由 fallback 现在共用is_local_session_primary_entry;CodeReview/DeepReview使用统一的运行时常量;- 新增显式 Local route 的 registry 测试,并确认
ReviewWorker仍被拒绝; - 相关 review agent 标识也完成了常量化,避免继续散落 magic string;
- GitHub CI 的 7 项检查全部通过。
未发现新的阻塞性问题,批准合并。
Problem
Entering
/reviewin the input box fails immediately with:The review child session (agentType=CodeReview for standard review, DeepReview for strict) can no longer be created or run.
Root cause
resolve_primary_agent_for_turn(registry) only acceptedAgentCategory::Modeentries in its local fallback, butCodeReviewis registered as aSubAgentandDeepReviewasHidden. Session creation, turn start, manual compaction, and session restore all funnel through this resolution, so:/reviewfails at child-session creation;agenticon restore.Regression introduced by
ca94825ad("feat(extensions): activate external primary agent profiles"), which wired this Mode-only filter into the create/turn paths.Fix
Allow the builtin
CodeReview/DeepReviewagents to resolve as local session primaries while keeping every other subagent (e.g.ReviewWorker) restricted, and add diagnostics at the rejection point (warn!when a registered non-mode agent is rejected,debug!when the id is unknown). Theexpected_owner == Externalfail-closed guard is unchanged.Follow-up cleanup (2nd commit)
CODE_REVIEW_AGENT_TYPEconstant introduced inagent-runtime::deep_review::constantsand used in registry review-entry detection and session-primary resolution, replacing the scattered"CodeReview"magic string. This cleanup also served as the verification content for the fix: it was written into a workspace, then reviewed end-to-end with the/reviewcommand after installing the fixed Windows build, confirming review sessions create and run correctly.Tests
agentic::agents::registry::tests::builtin_review_agents_resolve_as_local_session_primaries— CodeReview/DeepReview resolve with route owner Local.agentic::agents::registry::tests::non_session_primary_subagents_and_unknown_ids_do_not_resolve— ReviewWorker / unknown ids / external-owner guard stay rejected.agentic::coordination::coordinator::tests::review_agent_child_sessions_create_successfully— coordinator-level session creation for both agent types.All existing registry (33), coordinator (94), and session-manager (136) tests pass;
cargo check -p bitfun-core --no-default-featuresis clean.Closes #2100