feat: complete and harden the off-chain LLM resolver lifecycle - #1
feat: complete and harden the off-chain LLM resolver lifecycle#1iamnycx wants to merge 13 commits into
Conversation
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (52)
📝 WalkthroughWalkthroughThis PR overhauls the opal-resolver worker: adds resolution-spec reference verification (Arweave-backed), introduces a Parallel LLM adapter alongside Gemini, hardens config/preflight/health/crank subsystems, redesigns the poller loop with watchdog/health/alerting, adds operational scripts, e2e tests, and updates deployment/CI/docs. ChangesOpal Resolver worker changes
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant runLoop
participant runCycleDetailed
participant ArweaveResolutionSpecLoader
participant LlmAdapter
participant HealthFileReporter
participant runFinalizeCrank
runLoop->>runCycleDetailed: execute cycle
runCycleDetailed->>ArweaveResolutionSpecLoader: load(resolutionSpecReference)
ArweaveResolutionSpecLoader-->>runCycleDetailed: verified spec text
runCycleDetailed->>LlmAdapter: resolve(ResolutionRequest)
LlmAdapter-->>runCycleDetailed: Verdict | null
runCycleDetailed->>runFinalizeCrank: run (if enabled)
runFinalizeCrank-->>runCycleDetailed: CrankResult
runCycleDetailed-->>runLoop: CycleMetrics
runLoop->>HealthFileReporter: write(snapshot)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Summary
Completes and hardens the off-chain Opal LLM resolver lifecycle for devnet and production operation.
The resolver now verifies assertion-specific Resolution Specs, supports durable live-web research through Parallel, submits challengeable verdicts, recovers timed-out rounds, permissionlessly finalizes eligible assertions, supports resolver-key rotation, and fails closed when its runtime or on-chain configuration is unsafe.
Gemini grounding remains intentionally deferred until we get a paid Gemini key. The production live-web path uses Parallel.
What changed
Resolution pipeline
LlmResolutionRoundaccounts directly from chain state.PendingLLM.ar://<transaction-id>#sha256=<digest>True (0),False (1), orUnresolvable (3).LLM providers
Recovery and finalization
PendingLLMroundsUnresolvable.Unresolvableusing the no-fault settlement path.Resolver operations
Production hardening
SIGINT/SIGTERMto interrupt hung operations and write a finalstoppinghealth snapshot.CI and compatibility
Validation
Completed locally:
bun run test: 85 passed, 0 failedPendingLLMrecoveryRelated
Opal PR #31 must be merged and deployed before this worker is deployed because it provides the account layout, recovery, settlement, Resolution Spec, and resolver-rotation contracts required by the service.
On-chain compatibility
This resolver requires the corresponding Opal program version with:
ProtocolConfiglayoutllm_resolution_timeout_secondsrecover_pending_llmUnresolvablesettlementThe resolver intentionally refuses to start against an older or incompatible deployment.
Deferred deployment checks
These require team-managed credentials and are not blockers for reviewing the implementation:
Gemini grounding remains disabled by default. It does not block the Parallel-backed production path.