Repository navigation
feat(mock-ai): deterministic benchmark scenarios, strict session routing, and harness-bench runner - #7391
Open
M4n5ter wants to merge 4 commits into
Open
feat(mock-ai): deterministic benchmark scenarios, strict session routing, and harness-bench runner#7391M4n5ter wants to merge 4 commits into
M4n5ter wants to merge 4 commits into
Conversation
…routing, and harness-bench runner
Upgrade maka-mock-ai into a protocol-faithful, receipt-driven simulator for fair multi-harness stress benchmarking, and add a zero-dependency Node ESM benchmark runner under tools/harness-bench:
- Scoped routing & lineage (src/routing.rs, src/control.rs, src/proxy.rs):
- Single-pass /s/<run>/<session>/... route parser across HTTP, WS, /models/{id}, /v1/messages/count_tokens, /v1/responses/compact, and owner-scoped GET/DELETE /v1/responses/{id}.
- Explicit SessionRegistry, strict identity precedence with conflict diagnostics, side-channel/compaction classifier (Main / Side / Compact / Control), and separated session/lineage/stored-body lifecycles with lock-free drops.
- Proxy v2 canonical request fingerprints (including response_format, text.format, anthropic-beta, query, lane) with versioned compatibility checks and replay for response GET/DELETE.
- Deterministic semantic scenario engine & cross-harness tool binder (src/scenario/, src/schema_synth.rs):
- Receipt-driven atomic revision state machine with PlanRecipe/RequestKey idempotency across 429/503/disconnect/HTTP-WS retries, out-of-order parallel receipts, client & native compaction checkpoints, and runner observations via POST /admin/sessions/{id}/observations.
- Schema-validated (jsonschema) and freeform grammar tool binding across Maka (direct & Code Mode), Claude Code, Codex (custom apply_patch + nested namespace MCP), OpenCode v2, Pi 1.0, Pi-Durable, Dim, DeepSeek Harness, ZCode, Kimi Code, and Shared MCP.
- Wire codec fidelity & zero-waste streaming (src/protocol.rs, src/plan.rs, src/codec/, src/server/):
- EncodedFrame carries FrameKind + semantic_bytes (removing hot-path TTFT JSON reparsing and redundant non-streaming chunk iteration).
- Anthropic ping/thinking+signature/is_error/disable_parallel_tool_use/pause_after_compaction, Chat stream_options.include_usage & dialect-gated reasoning_content, Responses sequence_number/content_index/namespace/WS generate:false warmup.
- Observability, fact-driven watchdog & pacing (src/watchdog.rs, src/metrics.rs, src/pacing.rs, src/ratelimit.rs, src/server/admin.rs):
- Monotonic-ns AttemptSpan, dual-budget per-session rings, paginated /admin/sessions* export/finalize/reclaim, interval-union attribution (mock_service_sum / outside_mock_wall / mock_union), Prometheus status label fix, generation-guarded reset/faults, and absolute decode deadlines.
- Multi-harness benchmark runner (tools/harness-bench/):
- Zero-dependency Node ESM CLI (preflight, run, calibrate, matrix), 5 built-in scenarios, isolated workspace fixture verifier, stdio Shared MCP server with independent JSONL audit log, process-tree RSS/CPU monitor with SIGKILL injection, 16 isolated adapters (10 harnesses + ref-agent), and end-to-end tests.
…s, and short macOS TMPDIR
…-daemon mode, and fair cross-protocol error/overflow handling
…rt ApplyPatch file overwrites
This branch has not been deployed
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
Upgrades
maka-mock-aiinto an ultra-realistic, receipt-driven multi-protocol AI provider simulator suitable for fair, high-concurrency cross-harness stress benchmarking, and adds a zero-dependency Node ESM runner undertools/harness-bench/.tools/mock-aisrc/routing.rs,src/control.rs,src/proxy.rs):/s/<run>/<session>/...route parser covering HTTP, WebSocket upgrade,GET /v1/models/{id},POST /v1/messages/count_tokens,POST /v1/responses/compact, and owner-scopedGET/DELETE /v1/responses/{id}.SessionRegistryand identity resolver with conflict diagnostics; separated logical session / response lineage / stored-body lifecycles (deleting a parent mid-flight never loses an in-flight completed child; response body clones/drops happen outside locks).RequestClassifierisolatingMain / Side / Compact / Control(including OpenCode/Claude title side-calls and Codex native client summary requests, with positive and negative regression cases).response_format,text.format,anthropic-beta, query, lane), versioned cassette compatibility checks, and replay coverage for responseGET/DELETE.src/scenario/,src/schema_synth.rs):PlanRecipe+RequestKeyso 429/503/disconnect/HTTP↔WS retries replay the exact same decision with zero step skipping; supports out-of-order parallel receipts, client & native compaction checkpoints, andPOST /admin/sessions/{id}/observations.jsonschema+ freeform grammar binding across Maka (direct & Code Modeexec(code)), Claude Code, Codex (customapply_patch+ nestednamespaceMCP), OpenCode v2, Pi 1.0, Pi-Durable, Dim (nativeedit(oldText/newText)+exec(command)& Shared MCP), DeepSeek Harness, ZCode, Kimi Code, and Shared MCP.anyOf/oneOf.src/protocol.rs,src/plan.rs,src/codec/,src/server/):EncodedFrametagsFrameKindandsemantic_bytesdirectly, removing hot-path TTFT JSON reparsing and redundant non-streaming chunk iteration.event: ping, signed thinking,is_error,disable_parallel_tool_use,pause_after_compaction; Chatstream_options.include_usage& dialect-gatedreasoning_content; Responsessequence_number, independentcontent_index, nestednamespacecalls, and WSgenerate: falsewarmup returning emptyresponse.completed.src/watchdog.rs,src/metrics.rs,src/pacing.rs,src/ratelimit.rs,src/server/admin.rs):AttemptSpan, dual-budget per-session rings, paginated/admin/sessions*export/finalize/reclaim, interval-union three-way attribution (mock_service_sum/outside_mock_wall/mock_union), Prometheus mixed-status label fix, generation-guarded reset/fault counters, and absolute decode deadlines.tools/harness-benchpreflight,run,calibrate,matrix) with 5 built-in scenarios (smoke-edit,concurrency-fanout,long-compaction,chaos-recovery,mcp-smoke-edit), workspace fixture verifier, stdio Shared MCP server with independent JSONL audit log, process-tree RSS/CPU monitor +SIGKILLdurability injector, 16 isolated adapters (10 harnesses +ref-agent), and end-to-end tests.Verification
cargo test -p maka-mock-ai --no-fail-fast: 99 passed (69 lib + 12advanced_simulation+ 13protocol_conformance+ 5stress_and_scenarios)cargo check -p maka-mock-ai --no-default-features,cargo clippy -p maka-mock-ai --all-targets -- -D warnings,cargo fmt -p maka-mock-ai -- --check: passedmaka-model,maka-agent-native,maka-eval,maka-cli --tests): checked cleannode --test tools/harness-bench/bench.test.mjs: 7/7 passednode scripts/asf-license-headers.mjs check: passedmaka-mock-aionref-agent,claude,codex-http,codex-ws, anddim(native + Shared MCP)