Skip to content

test(core,cli): reference wire-size missions with a loose CI bound (#211 part 2) - #358

Merged
ajianaz merged 1 commit into
developfrom
test/wire-size-missions
Oct 9, 2026
Merged

ajianaz merged 1 commit into
developfrom
test/wire-size-missions

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What

Reference missions plus a loose CI bound on request size (PR 2 of 3 for #211). Test-only: no production code, no wire change, no CHANGELOG entry, README/epics untouched.

Why

#211 decided that the success measure is request CHARACTERS per reference mission, tokenizer-free, with a loose CI upper bound. PR 1 (#356) stores tole_wire per step; this PR turns it into a guard that fails when the system prompt, the tool specs or the re-sent history grow.

Changes

  • crates/tole-core/tests/wire_size_missions.rs (new): the real OpenAiProvider is driven through run_turn / resume_turn against a local mock OpenAI-compatible server (127.0.0.1:0, thread per connection, request read until the Content-Length body is complete, Connection: close, socket read timeouts, no usage in replies, so stored usage rows are wire-only). Missions: many_small_steps (20 requests, 200-char results), read_heavy (8 requests, 20,000-char results), mixed_with_resume (12 requests, results 200/2,000/5,000, crash after the 5th tool settled, resume from the on-disk file with a new provider/registry/mock). Registry (profile-independent, 22 specs): 8 real core tools (read_file, edit_file, delete_file, web_fetch, load_skill, todo_write, todo_read, verify_package) + 14 synthetic ReadOnly tools with realistic descriptions/parameter schemas.
  • Checks per mission: total-chars bound, first-step prefix (system+tools) bound, linear history growth, system/tools identical on every step, append-only request bodies. For the resume mission, post-resume request bodies are byte-identical to the uninterrupted run's.
  • Self-tests prove the guard fails on: +10,000-char system prompt, +5,000-char extra tool spec, history sent twice (wrapper provider), unstable prefix, reshuffled history.
  • crates/tole-cli/tests/tool_specs.rs: full_registry_tools_chars_within_bound.

Measured baselines and bounds (cargo test -p tole-core --test wire_size_missions -- --nocapture):

Measure Measured Bound
many_small_steps total 291,485 370,000
read_heavy total 647,498 810,000
mixed_with_resume total 277,380 350,000
prefix (system 1,436 + tools 8,454) 9,890 13,000
full default registry tools_chars (27 specs, shell-tools) 13,879 18,000

Bounds are ceil(measured x 1.25) rounded up. A bound bump needs a justification in the PR.

Testing

  • cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace --no-fail-fast, plus the --no-default-features / shell-tools check, clippy and test profiles and cargo check -p tole-core --no-default-features --tests: all green. The new test file ran under --no-default-features too (8 tests, ~1 s).
  • Note: acp_session_cancel failed once under heavy machine load in the first full-workspace run and passed on rerun in isolation and in the second full run (unrelated, pre-existing timing sensitivity).
  • Local cora review --staged returned a gateway 504 twice (exit 1, non-blocking).

Part of #211

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

⚠️ Review could not complete. LLM API error after retries: LLM API returned status 504: {"is_bifrost_error":true,"status_code":504,"error":{"error":"fasthttp: timeout","type":"request_timed_out","message":"request timed out (default is 300 seconds). You can increase it by setting the default_request_timeout_in_seconds in the network_config or in UI - Providers \u003e Provider Name \u003e Network Config."},"extra_fields":{"routing_info":{"provider":"glm","model":"glm-5.3","key":"b3"},"provider":"glm","original_model_requested":"glm-5.3","resolved_model_used":"glm-5.3","request_type":"chat_compl… [truncated]


Review powered by cora-code · BYOK · MIT

@ajianaz

ajianaz commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Merge-gate record for #358 (Cora verdict obtained by chunked local review; the gateway times out on the whole diff)

  • The Cora Review workflow failed on this PR four times with LLM API returned status 504 (request timed out, default is 300 seconds) (glm-5.3 via the gateway), and three local whole-diff runs failed the same way. No code finding was ever produced — it is a gateway timeout, not a review result. (Earlier PRs of this series, including +1.9k-line ones, passed Cora the same day.)
  • To still obtain a REAL Cora verdict, the diff was reviewed locally in chunks small enough for the 300 s limit (cora review --diff-file):
    • crates/tole-cli/tests/tool_specs.rs (+27): No issues found.
    • crates/tole-core/tests/wire_size_missions.rs (+809) split at the section divider (line 506): part 1 (lines 1–505) → 1 MAJOR "test file ships with zero tests"; part 2 (lines 506–809) → 1 MAJOR "file uses items (MissionRun, run_with, tmpdir, bounds) with no mod/use wiring; build breaks".
  • Both findings are artifacts of the split and were dismissed WITH EVIDENCE: part 1 contains 0 #[test] functions because all 8 tests live in part 2 (grep -c '^#\[test\]': 0 in lines 1–505, 8 in lines 506–809), and part 2 uses MissionRun, run_with, tmpdir and the bound constants that are defined in part 1 (same file, no mod wiring needed). The complete file compiles and its 8 tests pass in every CI profile.
  • CI on this head: 16/16 green (fmt, clippy, tests in the default, bare and shell-tools profiles, Evals, cargo audit, Trivy); code-scanning alerts: 0; the PR is test-only (no production code, no wire change).
  • The author's mutation self-tests show the guard has teeth: +10,000-char system prompt, +5,000-char tool spec and doubled history are each reported as violations; crash-resume request bodies are byte-identical to the uninterrupted run.

@ajianaz
ajianaz merged commit 3b1c970 into develop Oct 9, 2026
21 checks passed
@ajianaz
ajianaz deleted the test/wire-size-missions branch October 9, 2026 08:47
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