Skip to content

feat: async ChonkVerify protocol with request IDs and C++ worker threads#21196

Draft
AztecBot wants to merge 1 commit intonextfrom
claudebox/async-bbapi-verifier-threadpool
Draft

feat: async ChonkVerify protocol with request IDs and C++ worker threads#21196
AztecBot wants to merge 1 commit intonextfrom
claudebox/async-bbapi-verifier-threadpool

Conversation

@AztecBot
Copy link
Collaborator

@AztecBot AztecBot commented Mar 6, 2026

Summary

Adds async verification support to the bb IPC protocol, allowing ChonkVerify jobs to run on dedicated worker threads in C++ while the main IPC loop continues processing other requests.

Protocol change: Requests can now optionally include a request_id as [request_id, Command] (2-element array). The server detects this vs the legacy [Command] format automatically. Async responses are sent as [request_id, CommandResponse] and routed by ID on the TS side.

C++ changes:

  • IpcServer gains a thread-safe async response queue (enqueue_async_response) that worker threads push to, drained by the main loop between iterations
  • api_msgpack.cpp detects ChonkVerify commands with request_id > 0 and spawns std::thread workers. Each worker gets its own thread-local parallel_for pool (already lazy-initialized per thread). Uses a local BBApiRequest to avoid racing on the global one.
  • Worker threads call wakeup_all() after enqueuing results to minimize latency

TS changes:

  • Both socket and SHM backends now support callAsync() which wraps requests with a request_id and routes responses via Map<number, callback> instead of FIFO
  • Legacy call() still uses FIFO matching — fully backward compatible
  • IMsgpackBackendAsync interface gains optional callAsync?() method

This is the transport-layer foundation for the adaptive verifier pool (PR #21190) to dispatch multiple concurrent verification jobs through a single bb process.

Relates to Linear A-576.

ClaudeBox log: http://ci.aztec-labs.com/dbfbacde59b33f03-2

@AztecBot AztecBot added the claudebox Owned by claudebox. it can push to this PR. label Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant