Skip to content

test(cli): key the config_sensitive mock on the conversation, not the request count (#429) - #445

Merged
ajianaz merged 1 commit into
developfrom
test/deflake-config-hooks
Oct 27, 2026
Merged

ajianaz merged 1 commit into
developfrom
test/deflake-config-hooks

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

What

The scripted provider mock in crates/tole-cli/tests/config_sensitive.rs picks its answer from the conversation instead of from a request counter. Closes #429.

Why

on_pretool_from_config_runs_and_can_deny and on_posttool_and_on_turnend_from_config_run failed intermittently under machine load (four times on 2026-10-26, once in CI on #421): the tole run child exited 0, but the hook marker was never written. The mock answered request n with steps[min(n, last)], so a client retry consumed the next scripted step. The turn then received the final answer instead of the write_file tool call and never ran the tool.

Changes

  • spawn_mock: the step is steps[min(t, last)], where t is the number of role: tool messages already in the request's transcript. Every script in this file is one turn (a final, or a tool call then a final), so the scripts mean what they meant before; a retried request now gets the same answer.
  • The two hook tests keep the recorded requests and include the request count and the child's stderr in their failure messages, so a future failure is diagnosable from the log.
  • The now-unused request counter (AtomicUsize) is removed.

Testing

  • cargo test -p tole-cli --test config_sensitive: 23 passed.
  • cargo fmt --all --check, cargo clippy -p tole-cli --tests -- -D warnings: clean.
  • Cora agent-as-reviewer on the exact staged diff, judged from review_finalize: should_block: false, 0 issues.

… request count (#429)

The scripted mock answered request n with steps[min(n, last)], so a client retry under machine load consumed the next step: the turn got the final answer instead of the write_file call and the hook tests failed with a missing marker. The step is now chosen by the number of tool results already in the transcript, so a retried request gets the same answer. The two hook tests also report the provider request count and the child's stderr when they fail.
@ajianaz ajianaz added this to the 0.9.0 milestone Oct 27, 2026
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit cc357b3 into develop Oct 27, 2026
16 checks passed
@ajianaz
ajianaz deleted the test/deflake-config-hooks branch November 20, 2026 08:40
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.

test(cli): config_sensitive hook tests are flaky under machine load

1 participant