#332 Sherlock Phase 2: Implement Speculative Execution

wont-do medium Created 2025-12-09 17:52 · Updated 2025-12-10 02:19

Description

Edit
PHASE 2: Speculative Execution (Latency) CONTEXT: Waiting for verification (e.g., human approval or slow tests) blocks the workflow. Speculation assumes success and runs downstream tasks immediately. PROS: - Massive latency reduction for sequential chains. CONS: - 'Dual-write' risk: executing side effects (charging CC) based on unverified data. ARCHITECTURE (CRITICAL): - MUST use 'ParallelOperator' to fork 'Verifier' and 'Speculator' branches. - Speculative branch MUST be wrapped in a SAGA (ctx.saga). - If Verifier fails, it triggers ctx.run_compensations() to undo speculative actions. CODE EXAMPLE: builder.parallel('spec_fork', branches={ 'verifier': lambda b: b.task('human_review', ...), 'speculator': lambda b: b.task('deploy', ...) }) REQUIREMENTS: - DOCUMENTATION: Update docs/HIGHWAY_WORKFLOW_ENGINE_BOOK.md after implementation. - TESTING: Add comprehensive tests. Use ollama and deepseek-v3.1:671b-cloud model for testing (in tools/llm provider). - REGRESSION: No regression allowed. All @tests/integration/test_atomicity_baseline.py tests must pass.

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...