diff --git a/src/agent/graph/prompts/generator.py b/src/agent/graph/prompts/generator.py index 51fe1a3..ecce904 100644 --- a/src/agent/graph/prompts/generator.py +++ b/src/agent/graph/prompts/generator.py @@ -8,7 +8,12 @@ configuration, set needs_analysis=True and ask the analyzer. It is always \ better to ask than to invent a command that does not exist. If you need \ current/external info (latest action versions, provider docs, version-specific \ -syntax), set needs_web_research=True and ask the researcher. +syntax), set needs_web_research=True and ask the researcher. \ +VERIFICATION RULE: If you have even 1% doubt about any external fact, \ +version, syntax, or best practice, set needs_web_research=True and verify. \ +If you have even 1% doubt about any local project fact, command, script, \ +or configuration, set needs_analysis=True and ask the analyzer. \ +It is always better to verify than to guess. RULES: 1. Follow the pipeline plan exactly. diff --git a/src/agent/graph/prompts/planner.py b/src/agent/graph/prompts/planner.py index 42d49d1..4d51d8f 100644 --- a/src/agent/graph/prompts/planner.py +++ b/src/agent/graph/prompts/planner.py @@ -24,7 +24,10 @@ 2. ANALYZE FIRST — If the user did not provide an explicit command, or the explicit command has already been executed and recorded in analyzer results, but you still don't know the project's language, build system, \ test runner, deployment target, or available scripts, set needs_analysis=True \ and ask ONE specific, targeted question via analyzer_query. \ - NEVER GUESS. NEVER ASSUME. Always ask the analyzer. + NEVER GUESS. NEVER ASSUME. Always ask the analyzer. \ + VERIFICATION RULE: If you have even 1% doubt about any local project fact, \ + command, script, or configuration, set needs_analysis=True and verify. \ + It is always better to verify than to guess. 2.1 ANALYZER QUERY FORMAT (STRICT) - By default, analyzer_query must be a semantic question, NOT a shell command. - Only use an exact command in analyzer_query when the user explicitly requested that exact command. @@ -38,13 +41,16 @@ 2.2 RESEARCHER RESULTS - If RESEARCHER RESULTS are present in context, use \ them as authoritative external facts. Do not re-request the same info. -2.3 DIRECT WEB RESEARCH - If YOU know the plan depends on current/external \ +2.3 DIRECT WEB RESEARCH — If YOU know the plan depends on current/external \ info (e.g. you want to use the latest action version, or need current \ provider syntax), set needs_web_research=True and pass a precise \ researcher_query. Use the analyzer for LOCAL project facts and the \ researcher for CURRENT external facts. WHENEVER you have ANY doubt about \ an external fact or syntax, ALWAYS make the follow-up researcher_query. \ - NEVER guess. + NEVER guess. \ + VERIFICATION RULE: If you have even 1% doubt about any external fact, \ + version, syntax, or best practice, set needs_web_research=True and verify. \ + It is always better to verify than to guess. 3 ASK USER ONLY FOR PREFERENCES - If the blocker is a user preference/tradeoff \ (not discoverable from files), set needs_human_input=True and ask ONE clear \ @@ -62,7 +68,9 @@ available scripts, you MUST do so before planning any build/test/lint/deploy \ steps. If the project has no test script, do NOT add a test step. If there \ is no deploy script or deployment config, do NOT add a deploy step. \ - WHEN IN DOUBT, QUERY THE ANALYZER. + WHEN IN DOUBT, QUERY THE ANALYZER. If you have even 1% doubt about whether \ + a tool, command, or script exists in the project, set needs_analysis=True. \ + It is always better to verify than to assume. BAD: Planning "Run unit tests" without verifying a test script exists GOOD: Asking the analyzer "What scripts are in package.json?" first diff --git a/src/agent/services/run_summary/run_summary.py b/src/agent/services/run_summary/run_summary.py index 82ac191..fb8b398 100644 --- a/src/agent/services/run_summary/run_summary.py +++ b/src/agent/services/run_summary/run_summary.py @@ -33,4 +33,14 @@ def summarize_run(updates: list[str], llm: BaseChatModel) -> str | None: return None content = response.content - return content if isinstance(content, str) else str(content) + if isinstance(content, str): + return content + if isinstance(content, list): + parts = [] + for item in content: + if isinstance(item, dict) and item.get("type") == "text": + parts.append(str(item.get("text", ""))) + elif isinstance(item, str): + parts.append(item) + return "\n".join(parts) if parts else None + return str(content)