You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
review-dispatch: second dispatch in the same opencode session reuses the first dispatch's correlation ID and stale session metadata #760
Discovered during the /uf.unleash code-review gate on opsx/fix-triage-issue-dispatch-docs (2026-10-19): running a second review dispatch in the same opencode session (spec-review dispatch followed by code-review dispatch) causes consolidate_dispatch with provenance to fail closed with:
status: failed, operation_verdict: INCONCLUSIVE
errors:
- artifact commit must equal the immutable reviewed head SHA
- run <id> has no included plan entry
Root cause (verified in .opencode/plugins/review-dispatch/index.ts)
sessionCorrelationMap is an in-memory Map keyed by opencode sessionID (line ~571). dispatch_agent_runreuses the parent session's correlation ID on subsequent calls (lines ~2716-2721) and persists session_metadataonly on the first call (line ~2725: if (isFirstCall && input.session_metadata !== undefined)).
The first dispatch (spec review, correlation 8b645d7b) persisted ITS metadata. The second dispatch (code review) reused 8b645d7b, its session_metadata argument was ignored, and its runs overwrote the agent-keyed run-divisor-<agent>.json files in the same session dir.
consolidate_dispatch reads session-metadata.json fresh from disk → stale first-dispatch metadata (mode specs, old head_sha, old plan) → finalizer validation fails on context mismatch and runs-without-plan-entries.
Impact
Any opencode session that runs two different review dispatches (e.g. spec review then code review via /uf.unleash) cannot finalize the second dispatch without manual intervention.
Suggested fix directions
Key the dispatch session by dispatch identity (e.g. derive a fresh correlation per dispatch_review_runs invocation), or
Persist/refresh session-metadata.json whenever a differing session_metadata argument arrives (last-writer-wins with run-store compatibility check), or
Version the session store per dispatch invocation within one opencode session.
Recovery performed (for the record)
Backed up the first dispatch's finalization artifact and session metadata, rewrote session-metadata.json in the transient dispatch session dir with the byte-identical metadata the second dispatch had passed (and the plugin dropped), and re-ran consolidate_dispatch with the same provenance. Validation then passed; the finalizer assigned a fresh correlation (9124cbb3) to the finalized artifact. The stale-metadata file lives in /var/folders/66/kwgz6_q10ln_8hgzmqt0tbjr0000gn/T/ (transient plugin scratch state, not a governance artifact); run data was never affected.
Related follow-ups from the same change: #755 (consolidate payload assessment-fields extension), #756 (speckit-testreview dispatch data-flow audit).
The panel classifies this issue as a valid bug with objective, code-level evidence. All five assessing personas (adversary, architect, curator, guard, sre) reached the same verdict.
What the panel verified. The reported mechanism checks out against .opencode/plugins/review-dispatch/index.ts as filed on 2026-10-19: sessionCorrelationMap keys dispatch sessions by opencode sessionID, correlation resolution reuses the session's existing ID, and the first-call-only session_metadata persistence guard silently drops the second dispatch's metadata — so consolidate_dispatch reads stale first-dispatch metadata from disk and fails closed with "artifact commit must equal the immutable reviewed head SHA" and "run has no included plan entry". The recovery documented in the issue — rewriting session-metadata.json with the byte-identical metadata the plugin dropped, then re-running consolidation with the same provenance — isolates the stale metadata as the cause. Prior learnings record the identical failure signature recurring across at least four workflows between 2026-10-15 and 2026-10-23.
Remediation status. Both root-cause components are fixed at current HEAD, implementing the issue's own suggested fix directions:
Metadata persisted whenever supplied — dispatch_agent_run replaces session-metadata.json on every supply, removing the first-call-only guard (design D5 of fix-review-dispatch-recovery).
Tests cover the correlation mint in four suites (.opencode/test/dispatch-review-runs.test.ts, dispatch-agent-run.test.ts, consolidate-dispatch.test.ts, dispatch-status.test.ts); openspec/changes/fix-review-dispatch-correlation-release/ and the CHANGELOG record the change.
Recommended next steps.
Re-run the original scenario end-to-end (spec-review dispatch, then code-review dispatch, in one opencode session; consolidate the second with provenance) to confirm the fix in a live session.
Close this issue as completed referencing fix-review-dispatch-correlation-release once the live verification passes.
Duplicates: none found. #755 and #756 are distinct follow-ups already filed separately; #746 and #794 share the root cause but are not duplicates of this report.
This triage was performed by the Divisor review panel.
Activity
jflowers commentedon Nov 2, 2026
Divisor Triage: VALID — bug (objective)
The panel classifies this issue as a valid bug with objective, code-level evidence. All five assessing personas (adversary, architect, curator, guard, sre) reached the same verdict.
What the panel verified. The reported mechanism checks out against
.opencode/plugins/review-dispatch/index.tsas filed on 2026-10-19:sessionCorrelationMapkeys dispatch sessions by opencode sessionID, correlation resolution reuses the session's existing ID, and the first-call-onlysession_metadatapersistence guard silently drops the second dispatch's metadata — soconsolidate_dispatchreads stale first-dispatch metadata from disk and fails closed with "artifact commit must equal the immutable reviewed head SHA" and "run has no included plan entry". The recovery documented in the issue — rewritingsession-metadata.jsonwith the byte-identical metadata the plugin dropped, then re-running consolidation with the same provenance — isolates the stale metadata as the cause. Prior learnings record the identical failure signature recurring across at least four workflows between 2026-10-15 and 2026-10-23.Remediation status. Both root-cause components are fixed at current HEAD, implementing the issue's own suggested fix directions:
dispatch_review_runsnow mints a fresh correlation ID per invocation and re-points the session map before any session-creating side effect (design D1 offix-review-dispatch-correlation-release, review-dispatch: sessionCorrelationMap never releases the per-conversation correlation ID (root cause of #760 / #746) #794). Each workflow in one conversation now owns its dispatch session.dispatch_agent_runreplacessession-metadata.jsonon every supply, removing the first-call-only guard (design D5 offix-review-dispatch-recovery).Tests cover the correlation mint in four suites (
.opencode/test/dispatch-review-runs.test.ts,dispatch-agent-run.test.ts,consolidate-dispatch.test.ts,dispatch-status.test.ts);openspec/changes/fix-review-dispatch-correlation-release/and the CHANGELOG record the change.Recommended next steps.
/uf.address-feedbackmanifestation).fix-review-dispatch-correlation-releaseonce the live verification passes.Duplicates: none found. #755 and #756 are distinct follow-ups already filed separately; #746 and #794 share the root cause but are not duplicates of this report.
This triage was performed by the Divisor review panel.