Skip to content

Fix: Workers search filesystem instead of reading target file directly#2

Merged
aj-nt merged 4 commits into
mainfrom
fix/file-goal-decomposition
May 21, 2026
Merged

Fix: Workers search filesystem instead of reading target file directly#2
aj-nt merged 4 commits into
mainfrom
fix/file-goal-decomposition

Conversation

@aj-nt

@aj-nt aj-nt commented May 21, 2026

Copy link
Copy Markdown
Owner

Fixes #1.

When Gaap's decomposer receives a goal referencing a specific file path (e.g. summarize /tmp/release_review.md), workers spent 16 turns running find across directories instead of reading the target file directly. All workers timed out, orchestration failed.

Root cause: The agent catalog only had code-review types (static_analysis, quality_scan, synthesis). The decompose prompt had no notion of file goals. Workers defaulted to project-discovery patterns.

Fix (4 commits):

  1. Added file_analysis agent type to the catalog and decompose prompt
  2. Updated worker executor to detect file goals and skip project-discovery bias
  3. Short-circuited decomposition for file goalsextractFilePathFromGoal() scans for known extensions before the LLM call, returning a single file_analysis task immediately. The LLM was ignoring prompt instructions and still producing code-review DAGs; deterministic detection is more reliable.
  4. Added file_analysis to default CLI agent types so workers can claim the task

Tested: Live run of gaap run "summarize /tmp/test_goal.md" completed in 15 seconds with correct synthesis (file had no valuable content). Previously: 16 turns of find, 3 workers timed out.

AJ Flinton added 4 commits May 21, 2026 13:38
The decomposer only knew about code-review agent types (static_analysis,
quality_scan, synthesis). Goals referencing specific file paths got
decomposed into project-discovery tasks because no catalog entry matched.

Added 'file_analysis' agent type with tools (cat, head, tail, wc, grep,
file, stat) and a description that says 'first step is to read the
target file directly.' Updated the decompose prompt to detect file-path
goals vs codebase goals.
When context.source_path points to a file (not a directory), the worker
prompt now directs the worker to read the target file directly in the
first turn. File-goal prompts drop find/ls/language toolchains from
available tools and cap at 10 turns instead of 20.

Added looksLikeFilePath detector that checks file extensions (.md, .go,
.py, etc.) to distinguish file goals from codebase goals.
When the goal contains a file path (ending in a known extension like
.md, .go, .py), the Decomposer pipeline now extracts the path and
returns a single file_analysis task — bypassing the LLM strategy
entirely. The prompt-based approach was fragile: the LLM still
defaulted to code-review patterns.

extractFilePathFromGoal scans goals for known file extensions and
extracts the full path. fileGoalTask produces the single-task spec
with source_path set to the discovered file.
Without this, workers polled only for static_analysis and quality_scan
tasks. A file_analysis task from the decomposer short-circuit had no
matching worker — the orchestrator sat waiting until timeout.

Updated defaults in both parseRunFlags and parseResumeFlags to include
file_analysis. Updated help text, flag descriptions, and test assertions
to match.
@aj-nt aj-nt merged commit 2f1e050 into main May 21, 2026
2 of 3 checks passed
@aj-nt aj-nt deleted the fix/file-goal-decomposition branch May 21, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workers search filesystem instead of reading target file directly

1 participant