Factory: no review loop in planning chats
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a9a98a25e7
commit
fa6173d224
3 files changed
+31
No files matched your search
@@ -3,6 +3,13 @@
|
|||||||
All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/);
|
All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/);
|
||||||
until 1.0, minor versions may contain breaking changes.
|
until 1.0, minor versions may contain breaking changes.
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- The factory's planning chats (spec chat, "Plan a feature", "Cut a milestone") no longer run the review loop
|
||||||
|
of the agent mode (the "refine" rounds of build mode), which checked their answers as if they were code.
|
||||||
|
|
||||||
## [v202611-00049] – 2026-11-16
|
## [v202611-00049] – 2026-11-16
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -1529,6 +1529,16 @@ pub fn draft_of(app: &App, user: &User, session: &crate::types::Session) -> Opti
|
|||||||
(session.owner_id.as_deref() == Some(&user.id) && cwd.starts_with(&home) && cwd != home).then_some(cwd)
|
(session.owner_id.as_deref() == Some(&user.id) && cwd.starts_with(&home) && cwd != home).then_some(cwd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Is this a planning chat of the factory (spec chat in `_drafts`, issue chat in `_issues`)? They produce
|
||||||
|
/// text, not code, so the review loop of the agent mode is switched off for them.
|
||||||
|
pub fn is_planning_chat(app: &App, session: &crate::types::Session) -> bool {
|
||||||
|
app.factory_dir().is_some_and(|dir| is_planning_path(&dir, std::path::Path::new(&session.cwd)))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_planning_path(factory: &std::path::Path, cwd: &std::path::Path) -> bool {
|
||||||
|
cwd.strip_prefix(factory).map(|rel| rel.components().any(|c| c.as_os_str() == "_drafts" || c.as_os_str() == "_issues")).unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
/// Start a spec chat with the given model.
|
/// Start a spec chat with the given model.
|
||||||
pub fn start_spec_chat(app: &Arc<App>, user: &User, model: &str) -> Result<crate::types::Session> {
|
pub fn start_spec_chat(app: &Arc<App>, user: &User, model: &str) -> Result<crate::types::Session> {
|
||||||
let id = crate::types::new_id();
|
let id = crate::types::new_id();
|
||||||
@@ -1804,6 +1814,16 @@ mod tests {
|
|||||||
assert!(parse_result(t).is_some_and(|v| v["decision"] == "issues"));
|
assert!(parse_result(t).is_some_and(|v| v["decision"] == "issues"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn planning_chats_are_recognised_by_their_folder() {
|
||||||
|
let f = std::path::Path::new("/factory");
|
||||||
|
assert!(is_planning_path(f, std::path::Path::new("/factory/zink/_drafts/abc")));
|
||||||
|
assert!(is_planning_path(f, std::path::Path::new("/factory/zink/_issues/abc")));
|
||||||
|
assert!(!is_planning_path(f, std::path::Path::new("/factory/zink/zink/dunkelfeld")));
|
||||||
|
assert!(!is_planning_path(f, std::path::Path::new("/factory/zink/zink/_work/dunkelfeld-1")));
|
||||||
|
assert!(!is_planning_path(f, std::path::Path::new("/workspace/_drafts/x")));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn encodes_labels() {
|
fn encodes_labels() {
|
||||||
assert_eq!(urlenc("factory:qa"), "factory%3Aqa");
|
assert_eq!(urlenc("factory:qa"), "factory%3Aqa");
|
||||||
|
|||||||
@@ -293,6 +293,10 @@ pub async fn run_session(app: Arc<App>, session_id: &str, cancel: CancellationTo
|
|||||||
let roots = app.user_roots(session.owner_id.as_deref());
|
let roots = app.user_roots(session.owner_id.as_deref());
|
||||||
let root = app.root_for(session.owner_id.as_deref(), &cwd);
|
let root = app.root_for(session.owner_id.as_deref(), &cwd);
|
||||||
let mut agent = prompts::find_agent_for(&app, &root, &cwd, &session.agent, session.owner_id.as_deref());
|
let mut agent = prompts::find_agent_for(&app, &root, &cwd, &session.agent, session.owner_id.as_deref());
|
||||||
|
// Chats that plan (spec chat, issue chat) write no code: the mode's review of the work does not apply.
|
||||||
|
if crate::factory::is_planning_chat(&app, &session) {
|
||||||
|
agent.refine = None;
|
||||||
|
}
|
||||||
let clean_room = session.clean_room(app.config().craft.clean_room);
|
let clean_room = session.clean_room(app.config().craft.clean_room);
|
||||||
// The craft prompt follows the session's clean room / deep switch.
|
// The craft prompt follows the session's clean room / deep switch.
|
||||||
if agent.name == "craft" && agent.source == "builtin" {
|
if agent.name == "craft" && agent.source == "builtin" {
|
||||||
|
|||||||
Reference in new issue
Block a user