Skip to content

fix(agent): config, data and skill edits after a test run mark "tests pass" stale again - #8622

Merged
kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:fix/8213-stale-test-claims
Nov 20, 2026
Merged

kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:fix/8213-stale-test-claims

Conversation

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Since #8211, an agent could run the tests, then edit a config or skill file, and still report "tests pass": a requested settings.yaml, app.json, schema.sql, Dockerfile or .env, or any SKILL.md or prompt file, no longer marked the earlier run stale. Now only docs and requested reports (prose, text, tables, documents, images) leave a run standing, and anything under a skills or prompts folder counts as a change. In a live run on a gateway model, main answered "Tests pass" after setting retries: 0, a value that breaks the test. With this PR the agent flags the run as stale and says it can't confirm the tests pass.

Two smaller fixes from the same issue: a slow data or build script that times out gets the background-run and longer-timeout hint back (test and lint runs stay scoped to the changed files), and read_tool_output with a to_entry past the last part returns what is there instead of an error.

Test plan

  • New adversarial tests (test_stale_test_claim_config_skills.py): requested and unrequested config/data files at nested and absolute paths, every write tool and path key, same-name-elsewhere matches, skill/prompt files, an edit before vs after the run, a re-run after the edit (fresh again), several runs, a report written after a config edit, and docs that must not raise false alarms (README, docs/skills.md, myskills/README.md). 87 of them fail on main.
  • tests/unit/agents plus all shell-tool tests: 12169 passed. The only 2 failures (test_cyrillic_names_in_an_english_csv_are_not_windows_ansi, test_render_call_names_a_file_change_in_words) fail on main too.
  • black, isort, flake8, test-lane and tool-description lint pass. Pylint's 3 errors are Windows-only os.getuid/SIGKILL in files this PR doesn't touch.
  • Live, guarded (temp HOME, venv, proxy refusing local model loads), amd.DeepSeek-V4.1-Flash: run tests, edit settings.yaml / skills/greet/SKILL.md, then claim. Main misses both, this PR flags both. A README edit is flagged by neither.
  • Flagship eval on the next RC: gaia_core, gaia_honesty, gaia_code, gaia_files, gaia_shell
🔍 Technical details
  • Regressed in a760809 (fix(agent): cut wasted steps, stalls and empty answers in the agent loop #8211): is_code_mutation() exempted every requested non-code file that feeds_tests() didn't claim, and is_doc_path() classed SKILL.md as prose.
  • is_code_mutation() now exempts a requested file only when is_report_path() matches (_REPORT_SUFFIXES); is_code_path()/_CODE_SUFFIXES were left without callers and are removed.
  • feeds_tests() returns True for skill.md and for any skill(s)/prompt(s) folder below the project root.
  • _timeout_hint() takes the command and gives a script with no command_check_label() the background / longer-timeout hint.
  • Edits made through run_shell_command or run_python are still not judged, as before fix(agent): cut wasted steps, stalls and empty answers in the agent loop #8211 (see _FILE_MUTATION_TOOLS). A test pins that.
  • Not changed: a cut-off reply is already handled before parsing (finish_reason == "length"), and on the last step a reasoning-only reply goes to the step-cap closing call on purpose.

… pass" stale again

Since amd#8211, editing a requested config or data file (settings.yaml, app.json,
schema.sql, Dockerfile, .env, ...) or a SKILL.md / prompt file after a test
run left the earlier pass standing, so the agent could report "tests pass"
for code it changed afterwards.

- Only docs and requested reports (prose, text, tables, documents, images)
  are exempt; any other requested file still counts as a change.
- SKILL.md and anything under a skills or prompts folder is treated as a
  test input, never as a doc.
- A slow non-check script that times out gets the background-run and
  longer-timeout hint back; test and lint runs stay scoped to the changed
  files.
- read_tool_output with to_entry past the last entry returns what is there
  instead of raising.

Closes amd#8213
@github-actions github-actions Bot added documentation Documentation changes tests Test changes agents labels Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve

Restores an agent check that broke in 0.3.6. The agent could run the tests, then edit a config, data, skill or prompt file, and still report "tests pass." Now only docs and requested reports (prose, tables, documents, images) leave an earlier run standing. The PR also restores the "run it in the background or give it more time" hint for slow non-test scripts, and makes a to_entry past the end return what exists instead of an error. The logic is narrow, the tests are adversarial, and every doc that describes these rules was updated. I found nothing blocking.

One behaviour change to know before merging: a requested .json or .html output (for example "write result.json after the tests") now counts as a change. A truthful "tests pass" after writing one will be sent back for a re-run. This is deliberate and pinned by tests, so I'm raising it to confirm the trade-off, not to block.

Real-world evidence

N/A: no evidence bundle was produced for this run. On this runner the verdict rests on static review alone. The PR description reports a guarded live run on amd.DeepSeek-V4.1-Flash: main misses both the settings.yaml edit and the SKILL.md edit, this branch flags both, and a README edit is flagged by neither. I could not reproduce that here. The flagship eval categories it names (gaia_core, gaia_honesty, gaia_code, gaia_files, gaia_shell) are left for the next RC.

🔍 Technical details

Issues

🟢 Requested .json / .html outputs now trigger a re-run (src/gaia/agents/base/verification.py, _REPORT_SUFFIXES). #8211 exempted these on purpose, to stop false corrections on an honest pass after the agent writes the requested write-up. This PR flips that, and test_a_requested_config_or_data_file_still_counts pins the new behaviour. Erring towards stale fits feeds_tests' "a wrong True only asks for a re-run". Still, it is the one place where this PR adds corrections on truthful answers, so gaia_honesty / gaia_files on the next RC are the ones to watch.

🟢 Docs and prompt guides under a skills / prompts folder now count as changes. feeds_tests runs before is_doc_path, so docs/skills/intro.md or docs/prompts/guide.md now makes a run stale. docs/guides/skills.md doesn't, because there skills is the filename, not a folder. This errs safe and needs no change; I'm noting it because the docs paragraph says "a text or image file under a docs folder" is documentation without that exception.

🟢 Unwrapped long line (docs/sdk/core/agent-system.mdx:1451). The appended clause runs well past the paragraph's wrap width:

the valid range; a `to_entry` past the last entry reads to the end. Unicode
offsets count characters, not bytes.

Checked and fine

  • _read_entries: first is still validated by _entry_span, the type check on last remains, and last < first still raises before the clamp. min(last, len(spans)) bounds the loop, so 10**9 doesn't spin. The page-budget path keeps next_entry, which the new test covers.
  • _timeout_hint(..., command=""): the existing callers in test_turn_time_limit.py pass no command. A bare script then gets the longer-timeout hint, and cut_by_time_limit still returns first, so those tests are unaffected.
  • is_code_path / _CODE_SUFFIXES in verification.py have no remaining callers. completion.py has its own _CODE_SUFFIXES, which is untouched.
  • The CHANGELOG's "Since 0.3.6" is correct: a760809dd6 first shipped in agent-pkg-gaia-v0.3.6.
  • Doc sync: the shell timeout hint (shell-tools-mixin.mdx), the stale-run rule and the to_entry range (agent-system.mdx) were all updated. A grep turned up no stale copy of the old wording.

Strengths

  • The new test file targets what really breaks: same-name matches in other folders, the last-suffix-only rule, Windows/absolute paths, skills folders above the project root, ordering across several runs, and two loop-level tests that drive process_query end to end.
  • A test pins the known gap (shell- and run_python-made edits aren't judged), so it is a documented decision rather than a silent hole.
  • Lint-like scripts (python util/lint.py, -m flake8) are told apart from data jobs through the existing command_check_label, rather than a new list.

@kovtcharov-amd
kovtcharov-amd merged commit 0dfe830 into amd:main Nov 20, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents documentation Documentation changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant