Repository navigation
v0.2.1 — Protocol Stability & Persistence Fix
Overview
This release represents a critical stability and persistence overhaul of the BioVerify AI Agent architecture. It transitions the protocol from ephemeral, memory-based state to a durable, multi-agent persistence layer using Postgres (Neon), while resolving race conditions within serverless environments.
Key Changes
1. Durable Agent Persistence (LangGraph + Postgres)
- Infrastructure: Migrated from
MemorySavertoPostgresSaverusing a singleton connection pool for Neon. - State Recovery: Agents can now durably "pause" for Human-In-The-Loop (HITL) interactions and resume across different execution contexts without state loss.
- Schema Setup: Added
db:setup-agentsscript to automate checkpointer table initialization in the agent database.
2. Multi-Agent Namespacing (Thread ID Architecture)
- Collision Prevention: Refactored
getThreadIdto use a namespaced format:AGENT_TYPE::PUB_ID::ROOT_CID. This prevents state pollution between Submission and Review graphs. - Parsing Logic: Updated EIP-712 signature verification to utilize the new namespaced thread format, ensuring validators correctly map signatures to specific agent types.
3. Vercel & Serverless Reliability
- Process Suspension Fix: Applied
awaitto AI agent invocations within the CQRS command handlers. This prevents Vercel from suspending the serverless function before the agent completes its automated audit or on-chain settlement. - Error Handling: Implemented comprehensive try/catch blocks in agent entry points with Telegram alerting for real-time crash reporting.
4. Security & Debugging
- Authorization Guards: Added explicit
PRODUCTION_AUTH_CHECKlogging and validation inresumenodes to ensure only assigned peer/senior reviewers can advance the state machine. - EIP-712 Alignment: Synchronized the server-side crypto utilities with the new thread ID delimiter (
::) to ensure human reviewer signatures validate against the correct publication metadata.
Technical Breakdown
| Package | Change Description |
|---|---|
| @packages/agents | Transitioned submissionGraph and reviewersGraph to use pgCheckpointer. |
| @packages/cqrs | Updated processContractEvent to await agent results and log execution status. |
| @packages/utils-server | Updated verifyRewiewEip712 to parse namespaced threadId. |
| @packages/utils | Unified AgentType enum and getThreadId logic. |
| @packages/db | Updated workspace scripts for centralized database management. |
Verification Results
The protocol's multi-gate state machine has been manually verified on Base Sepolia staging across all logical paths. Note: In all scenarios, participant rewards, stake slashes, and reputation scores were confirmed to be correctly computed and updated on-chain.
Gate 1: Submission Agent (Automated Audit)
- Scenario: Early Slash
- AI detects plagiarism or integrity failure ->
earlySlashPublicationtriggered. - Result: Status set to
1(EARLY_SLASHED). No reviewers assigned.
- AI detects plagiarism or integrity failure ->
Gate 2: Review Agent (Human-In-The-Loop)
- Scenario: Consensus PASS
- Submission agent passes (
IN_REVIEW) -> Human reviewers agree on validity. - Result: Status set to
4(PUBLISHED).
- Submission agent passes (
- Scenario: Consensus FAIL
- Submission agent passes (
IN_REVIEW) -> Human reviewers agree on invalidity. - Result: Status set to
3(SLASHED).
- Submission agent passes (
- Scenario: Escalation (Conflict Resolution)
- Submission agent passes (
IN_REVIEW) -> Human reviewers disagree -> Senior Reviewer tie-break. - Result: AI aligns on Senior verdict; status updated to
3or4accordingly.
- Submission agent passes (