Repository navigation
fix(agent): bound exact trajectory materialization - #31
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens and restructures the batchbench-agent synthetic text and admission pipeline so that replay/synthetic prompts are generated exactly at the requested token counts (failing closed if not achievable), while keeping trajectory text generation lazy, deterministic, and memory-bounded during agent execution.
Changes:
- Introduces a
SyntheticTextGeneratorthat deterministically generates per-agent/per-turn text streams, bounds concurrent materialization via a semaphore, and enforces exact re-encode token counts. - Moves initial prompt materialization out of the benchmark clock and adds concurrent replacement preparation while preserving FIFO admission semantics.
- Serializes request bodies into an immutable
Bytespayload (instead of building a mutableserde_json::Value) to avoid cloning large message trees during retries/in-flight work.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| rust/src/agent.rs | Adds deterministic, bounded synthetic text generation; materializes initial prompts pre-benchmark; concurrent FIFO replacement preparation; serializes request bodies to Bytes. |
| rust/Cargo.toml | Adds bytes dependency and enables Tokio sync for semaphore-based bounded work. |
| rust/Cargo.lock | Locks the new bytes dependency. |
| README.md | Updates documentation to reflect exact-token fail-closed generation and concurrent replacement preparation semantics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
Validation
cargo fmt --manifest-path rust/Cargo.toml -- --checkcargo check --manifest-path rust/Cargo.toml --all-targetscargo check --manifest-path rust/Cargo.toml --features pythoncargo test --manifest-path rust/Cargo.toml(51 passed)This keeps the v1 JSONL schema and CLI unchanged.