Skip to content

fix(agent): stop the Plan phase demanding target_files for file-less tasks - #74

Merged
netty-linux merged 1 commit into
masterfrom
fix/plan-phase-target-files
Aug 10, 2026
Merged

fix(agent): stop the Plan phase demanding target_files for file-less tasks#74
netty-linux merged 1 commit into
masterfrom
fix/plan-phase-target-files

Conversation

@netty-linux

Copy link
Copy Markdown
Owner

Root cause

_generate_spec asked every MEDIUM/HIGH task for "any files you expect to create or modify" — unconditionally, with no notion that many tasks produce no files.

target_files is load-bearing well past the plan itself:

  • SpecValidator.verify fails the run when a listed file is absent from disk
  • only writes to a listed file count as progress for the adaptive step budget (_step_touched_target_file)

So a file-less task was pushed to invent filenames, then failed verification for not having created them, then entered a [VERIFY-CORRECTION] round chasing a file it had made up — and could never earn a step extension.

Observed in a downstream general-purpose chat product: "gere uma cobrança PIX" produced write_file + python_sandbox ×3 + read_file + list_directory, errored reading a nonexistent output/test_results.txt, and never called the dedicated payment tool.

Changes

  1. target_files is now explicitly optional. Both the JSON schema (field description) and the instruction text state it belongs empty when the task produces no files, and say why — each entry is verified to exist afterwards. This is the actual fix.
  2. AgentConfig.plan_complexity_threshold"medium" (default, current behavior) | "high" | "never". IntentParser falls back to MEDIUM whenever no keyword heuristic matches and no router.classifier_model is set, so a conversational deployment plans on effectively every turn. An unrecognized value falls back to the default rather than silently stripping the phase.

Default behavior is unchanged for every existing consumer.

Test plan

  • 6 new tests: threshold gating (medium/high/never/unknown), end-to-end skip and end-to-end no-regression, and the spec instruction's content
  • uv run pytest --cov — 686 passed, 84.80% coverage
  • uv run ruff check . / ruff format --check .
  • uv run pyright — 0 errors

…tasks

_generate_spec asked every MEDIUM/HIGH task for "any files you expect to
create or modify" unconditionally. target_files is load-bearing well
past the plan: SpecValidator.verify fails the run when a listed file is
absent from disk, and only writes to a listed file count as progress for
the adaptive step budget. So a task that produces no files at all — a
payment charge, a web search, a plain answer — was pushed to invent
filenames, then failed verification for not creating them, then entered
a VERIFY-CORRECTION round chasing a file it had made up.

Observed in a downstream chat product: "gere uma cobrança PIX" produced
write_file + python_sandbox + read_file + list_directory and an error
reading a nonexistent output/test_results.txt, never calling the
dedicated payment tool.

Both the schema and the instruction now state that target_files is
optional and belongs empty when the task produces no files, and say why
(each entry is verified to exist afterwards).

Also adds AgentConfig.plan_complexity_threshold ("medium" | "high" |
"never", default "medium" = current behavior). IntentParser falls back
to MEDIUM whenever no keyword heuristic matches and no
router.classifier_model is configured, so a general-purpose deployment
plans on effectively every turn; "high" lets it plan only for genuinely
complex work. An unrecognized value falls back to the default rather
than silently disabling the phase.
@netty-linux
netty-linux merged commit 823aacc into master Aug 10, 2026
11 checks passed
@netty-linux
netty-linux deleted the fix/plan-phase-target-files branch August 10, 2026 13:00
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.

1 participant