Skip to content

fix(agent): bound exact trajectory materialization - #31

Merged
rushilbhat merged 1 commit into
mainfrom
codex/exact-lazy-trajectory-workload
Aug 28, 2026
Merged

rushilbhat merged 1 commit into
mainfrom
codex/exact-lazy-trajectory-workload

Conversation

@rushilbhat

Copy link
Copy Markdown
Contributor

Summary

  • make synthetic replay text fail closed at the exact requested token count, including shared byte-offset tokenizers
  • keep future trajectory text lazy and memory-bounded with deterministic per-agent/per-turn streams
  • prepare rolling replacements concurrently while preserving FIFO admission and routing slots
  • serialize requests from borrowed live history into an immutable retryable byte body

Validation

  • cargo fmt --manifest-path rust/Cargo.toml -- --check
  • cargo check --manifest-path rust/Cargo.toml --all-targets
  • cargo check --manifest-path rust/Cargo.toml --features python
  • cargo test --manifest-path rust/Cargo.toml (51 passed)
  • real GLM-5.2 tokenizer regression at 2,857 tokens
  • 65,536-token initial-prompt stress case

This keeps the v1 JSONL schema and CLI unchanged.

Copilot AI lite review requested due to automatic review settings August 28, 2026 09:15
@rushilbhat
rushilbhat merged commit db25278 into main Aug 28, 2026
3 checks passed
@rushilbhat
rushilbhat deleted the codex/exact-lazy-trajectory-workload branch August 28, 2026 09:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SyntheticTextGenerator that 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 Bytes payload (instead of building a mutable serde_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.

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.

2 participants