Repository navigation
test(cli): key the config_sensitive mock on the conversation, not the request count (#429) - #445
Merged
Merged
Conversation
… 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.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The scripted provider mock in
crates/tole-cli/tests/config_sensitive.rspicks its answer from the conversation instead of from a request counter. Closes #429.Why
on_pretool_from_config_runs_and_can_denyandon_posttool_and_on_turnend_from_config_runfailed intermittently under machine load (four times on 2026-10-26, once in CI on #421): thetole runchild exited 0, but the hook marker was never written. The mock answered request n withsteps[min(n, last)], so a client retry consumed the next scripted step. The turn then received the final answer instead of thewrite_filetool call and never ran the tool.Changes
spawn_mock: the step issteps[min(t, last)], where t is the number ofrole: toolmessages 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.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.review_finalize:should_block: false, 0 issues.