Repository navigation
Description
Summary
Live reproduction during the 2026-10-23 triage series confirmed the root cause behind #760 (second dispatch reuses the first dispatch's correlation ID) and #746 (one dispatch session per conversation breaks finalization): the review-dispatch plugin intentionally binds exactly one dispatch correlation ID per opencode conversation and never releases it.
Root cause
.opencode/plugins/review-dispatch/index.ts (file REV 5538A3CC):
sessionCorrelationMapis a module-levelMap<parent-session-ID, correlation-ID>(line 578) that lives for the opencode process lifetime. Only.get()and.set()are ever called on it — there is no delete, expiry, or reset path.dispatchAgentRunmints a UUID on the first call from a parent session and reuses it for all subsequent calls in that session (documented at lines 568-577, implemented at lines 3270-3277):
let correlationId = sessionCorrelationMap.get(context.sessionID)
const isFirstCall = correlationId === undefined
if (isFirstCall) {
correlationId = randomUUID()
sessionCorrelationMap.set(context.sessionID, correlationId)
}- The same-session re-dispatch flow this supports is the fix loop (design D5 of fix-review-dispatch-recovery, review-dispatch: failed child run with accepted submissions bricks consolidate_dispatch finalization #751): re-dispatching the same review with an updated plan, where session metadata is replace-with-latest so
consolidate_dispatchvalidates runs against the current plan (lines 3279-3285). The design contract is one dispatch session = one review workflow = one conversation. Running multiple different dispatch workflows (for example, several/uf.triage-issueruns) from one conversation is outside that contract and silently reuses the first workflow's correlation.dispatch_review_runsinherits the same binding (observed live, below), and neitherdispatch_review_runsnordispatch_agent_runexposes a correlation control — the explicitcorrelation_idescape hatch (design D3) exists only on the read/finalize side (consolidate_dispatchline 3714,dispatch_statusline 4846).
Observed failure (live, 2026-10-23)
/uf.triage-issueon Extract plugin helpers into shared libs (issue-reference + state-path) #782 dispatched 5 reviewers under correlationf38bb0f6-2e3e-4c4e-ba39-cef495379ed3and finalized it (APPROVE / VALID, 2026-10-23T02:33:28Z) — record persisted to.uf/artifacts/dispatch/f38bb0f6-….json./uf.triage-issueon fix: verify replacement run-file persistence before reporting redispatched outcome #771 from the same opencode conversation dispatched 6 reviewers (2026-10-23T02:36:47Z). The dispatch resolved the conversation's existing correlation and reusedf38bb0f6.- The dispatch-session state under a correlation is replace-with-latest, so fix: verify replacement run-file persistence before reporting redispatched outcome #771's run files, plan, and session metadata replaced Extract plugin helpers into shared libs (issue-reference + state-path) #782's. Extract plugin helpers into shared libs (issue-reference + state-path) #782's finalization artifact on disk was untouched — the dispatch does not write finalization artifacts.
- Had fix: verify replacement run-file persistence before reporting redispatched outcome #771 then been finalized,
persistEnvelope's collision path would have engaged (see correction below): Extract plugin helpers into shared libs (issue-reference + state-path) #782's artifact survives, but fix: verify replacement run-file persistence before reporting redispatched outcome #771's finalization record would carry a correlation that does not match its dispatch session's run files — broken traceability between artifact and dispatch state.
Correction to the #746 failure-class framing: finalizing a second workflow under a reused correlation does not overwrite the first workflow's artifact. persistEnvelope publishes via hard link and on EEXIST retries with a freshly minted correlation_id (lines 2477-2515), so the second finalization lands under a new artifact UUID. The damage is linkage corruption (artifact correlation ≠ dispatch-session correlation), not data loss.
Fix directions
Any fix must preserve two existing contracts:
- the fix-loop re-dispatch flow (design D5): same-workflow re-dispatches in one conversation share a correlation with replace-with-latest session metadata; and
- the recovery tools (DR-FR-001 / DR-FR-002), which address a dispatch session purely by
correlation_id.
Directions to consider:
- Per-dispatch correlation keying. Mint a fresh correlation per
dispatch_review_runsinvocation (content-keyed, or a per-session dispatch counter), updatingsessionCorrelationMapto the newest correlation soconsolidate_dispatchauto-resolution keeps working. Fix-loop iterations would each get their own dispatch dir;redispatch_failed_runs' reuse of run files under one correlation needs re-examination under this model. - Explicit release/reset. Expose dispatch-side correlation control symmetric to design D3:
consolidate_dispatchanddispatch_statusalready accept an optional explicitcorrelation_idfor cross-session use, but there is no way to ask a dispatch for a fresh correlation or to release the session binding (anew_dispatchflag, acorrelation_idinput on the dispatch tools, or a reset tool).
Salvage option for #771 (no re-dispatch required)
From a fresh opencode session, run consolidate_dispatch with explicit correlation_id: f38bb0f6-2e3e-4c4e-ba39-cef495379ed3 plus provenance. The dispatch-session state under that correlation currently holds #771's panel result (5/5 VALID; 4 of 5 personas verified the issue's fix already landed via PR #776, so the likely disposition is close-as-completed linking #776). Finalization validates those runs and — via the EEXIST collision path — persists under a fresh artifact UUID, leaving #782's artifact intact. The payload will also re-surface #771's five not-yet-stored lesson proposals.
Relations
- review-dispatch: second dispatch in the same opencode session reuses the first dispatch's correlation ID and stale session metadata #760 — second dispatch reuses first correlation ID (symptom)
- review-dispatch: one dispatch session per conversation silently breaks uf.address-feedback per-item Tier 2 finalization #746 — one dispatch session per conversation breaks finalization (symptom)
- review-dispatch: failed child run with accepted submissions bricks consolidate_dispatch finalization #751 — fix-review-dispatch-recovery (introduced the map's current semantics, designs D3/D5)
- fix: verify replacement run-file persistence before reporting redispatched outcome #771 — salvage candidate described above
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
fix(review-dispatch): mint per-invocation correlation in dispatchRevi…
test(review-dispatch): pin per-invocation correlation lifecycle
test(review-dispatch): cover latest-dispatch resolution in consolidat…
fix(review-dispatch): mint per-invocation correlation in dispatchRevi…
test(review-dispatch): pin per-invocation correlation lifecycle
test(review-dispatch): cover latest-dispatch resolution in consolidat…