From 7dd66d0d098d6049666b8fafaabfdfb85cd7af04 Mon Sep 17 00:00:00 2001 From: King Flowers Date: Fri, 23 Oct 2026 22:38:55 -0500 Subject: [PATCH] fix: make Claude binary provider lanes work with Claude Code 2.1 Remove --permission-mode plan from the claude argv in the candidate, chat, and live provider adapters. Claude Code 2.1 refuses to emit the requested deliverable in plan mode and returns prose instead, so every New task build failed with task_provider_output_invalid. Tools are already disabled with --tools "", so plan mode added no containment. State the base_hash contract explicitly in the candidate prompt (null for create, the input file's content_hash for replace). Without it the model sometimes returned a string for new files, failing task_provider_base_hash_invalid. Verified end to end on Windows with claude.exe 2.1.296 under a Claude Max login: goal -> candidate ready -> structural check exit 0 -> accept -> apply wrote the file to the project. Full pytest suite passes. Co-Authored-By: Claude Fable 5.1 --- src/torq_cli/adapters/candidate_provider.py | 2 -- src/torq_cli/adapters/chat_provider.py | 2 -- src/torq_cli/adapters/live_provider.py | 2 +- src/torq_cli/application/candidate_tasks.py | 4 +++- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/torq_cli/adapters/candidate_provider.py b/src/torq_cli/adapters/candidate_provider.py index 2faa36e..64d0d37 100644 --- a/src/torq_cli/adapters/candidate_provider.py +++ b/src/torq_cli/adapters/candidate_provider.py @@ -105,8 +105,6 @@ def __call__(self, prompt: str) -> CandidateProviderCommand: "--tools", "", "--no-session-persistence", - "--permission-mode", - "plan", "--disable-slash-commands", "--safe-mode", "--no-chrome", diff --git a/src/torq_cli/adapters/chat_provider.py b/src/torq_cli/adapters/chat_provider.py index 74be08b..0d910ec 100644 --- a/src/torq_cli/adapters/chat_provider.py +++ b/src/torq_cli/adapters/chat_provider.py @@ -60,8 +60,6 @@ def __call__( "--tools", "", "--no-session-persistence", - "--permission-mode", - "plan", "--disable-slash-commands", "--safe-mode", "--no-chrome", diff --git a/src/torq_cli/adapters/live_provider.py b/src/torq_cli/adapters/live_provider.py index 72eb064..a4e583c 100644 --- a/src/torq_cli/adapters/live_provider.py +++ b/src/torq_cli/adapters/live_provider.py @@ -295,7 +295,7 @@ def _claude_compatible( ( self.claude_binary, "-p", "--output-format", "json", "--model", model, "--json-schema", json.dumps(schema, separators=(",", ":")), - "--tools", "", "--no-session-persistence", "--permission-mode", "plan", + "--tools", "", "--no-session-persistence", "--disable-slash-commands", "--setting-sources", "", "--strict-mcp-config", "--mcp-config", '{"mcpServers":{}}', ), diff --git a/src/torq_cli/application/candidate_tasks.py b/src/torq_cli/application/candidate_tasks.py index f3bfefd..b5fc17d 100644 --- a/src/torq_cli/application/candidate_tasks.py +++ b/src/torq_cli/application/candidate_tasks.py @@ -678,7 +678,9 @@ def _prompt(self, plan: Mapping[str, Any], input_bundle: Mapping[str, Any], plan "Return only one JSON object with no markdown. Tools and filesystem access are unavailable. " "The contract field must be exactly torq-candidate-output-v1. The exact schema is " "{contract,plan_hash,input_hash,operations}; each operation is " - "{operation:create|replace,path,base_hash,content}. Produce at least one changed UTF-8 file " + "{operation:create|replace,path,base_hash,content}. For create (a path not present in " + "input.files) base_hash must be JSON null. For replace, base_hash must be the exact " + "content_hash string of that path from input.files. Produce at least one changed UTF-8 file " "and only paths in allowed_output_paths.\n" + canonical_json({"plan_hash": plan_hash, "input_hash": input_hash, "goal": plan["goal"], "allowed_output_paths": plan["output_paths"], "input": input_bundle}) )