Repository navigation
fix(review-dispatch): per-invocation correlation for dispatch sessions - #809
Conversation
…ewRuns Implements RD-CR-001..003 for unbound-force#794: dispatchReviewRuns mints a fresh correlation ID after input validation and re-points sessionCorrelationMap (latest-wins), so consecutive aggregate dispatches from one conversation no longer clobber each other. correlation_id is now reported on every post-validation return path. Scaffold twin synced byte-identical.
Task 4.1 of fix-review-dispatch-correlation-release for unbound-force#794: replace the FR-007 "correlation is shared" assertion with the RD-CR-001..002 lifecycle. Two aggregate dispatches from one parent session now mint distinct correlations with distinct dispatch session dirs, and the first session's run files, prompts, and metadata survive the second invocation. All-skip and prompt-failure invocations re-point the session map at a session-less correlation so no-provenance consolidation fails closed as not_found while the earlier session stays addressable by explicit correlation_id. The output summary and metadata report the invocation's correlation_id ("none" on the pre-parse validation-failure path), and prompts are asserted to land under the session's prompts/ dir. Full suite: 39 files, 1188 tests, statements coverage 95.24% (94% floor held).
…e/status Extends task 4.2 of fix-review-dispatch-correlation-release for unbound-force#794 (RD-CR-001): after two real aggregate dispatches from one parent session, no-provenance consolidate_dispatch and dispatch_status resolve the latest session while an explicit correlation_id retrieves the earlier session's payload (its run files and session metadata survive the second invocation). An all-skip invocation re-points the map at a session-less correlation, so no-provenance retrieval fails closed as not_found while the explicit id still recovers the earlier dispatch. Dispatch sessions are driven through dispatch_review_runs with the fake-client scratch-project pattern — no network, no live providers.
…n joining Extends dispatch-agent-run.test.ts with the RD-CR-003 regression guards for task 4.3 of fix-review-dispatch-correlation-release: direct multi-call fan-out mints the correlation on the first call and reuses one session (all run files land under a single dispatch directory), and a direct dispatch_agent_run following an aggregate dispatch_review_runs joins the latest aggregate session's correlation. Per-invocation minting in dispatchAgentRun would shatter direct fan-out into N sessions that consolidation cannot validate as one plan; dispatchAgentRun itself is unchanged (design D2). Assisted-by: glm-5 Generated with AI assistance (glm-5)
Also marks all fix-review-dispatch-correlation-release tasks complete in tasks.md.
…patch-correlation-release
- docs: file website issue unbound-force#319 for the dispatch-session lifecycle change and extend the CHANGELOG citation (Docs: unbound-force#808) - refactor(test): extract aggregate-dispatch fixtures duplicated across four suites into test/helpers/aggregate-dispatch-fixtures.ts - fix: resolve post-dispatch findings collection with the invocation's own minted correlation instead of a session-map re-read, keeping collection self-consistent under concurrent invocations from the same parent session Scaffold mirror synced byte-identical.
Capture knowledge artifacts from the fix-review-dispatch-correlation-release workflow sessions: - review-dispatch: correlation lifecycle, latest-dispatch resolution, and code council feedback (5 learnings) - content-pipeline: triage pipeline patterns (2 learnings) - documentation-pipeline: doc gate patterns (1 learning) - openspec: workflow clarification patterns (2 learnings) - uf-unleash: tier-routing and resume learnings (2 learnings) Assisted-by: glm-5 Generated with AI assistance (glm-5)
jflowers
left a comment
There was a problem hiding this comment.
Divisor Council Review — APPROVE WITH ADVISORIES
Council verdict: APPROVE WITH ADVISORIES — 3 successful personas (2× APPROVE WITH ADVISORIES, 1× APPROVE); 1 adversary run failed with a retryable infrastructure error and does not vote.
Summary
This change gives each dispatch_review_runs invocation its own correlation ID minted after input validation, persists prompts, run records, and session metadata under a per-invocation session directory, and reports correlation_id on every post-validation return path. This removes the single-correlation-per-conversation clobbering documented in #794. Sixteen net-new regression tests cover the live repro, fail-closed retrieval, and direct fan-out semantics; the scaffold twin is synced byte-identical.
Findings (5 advisories, non-blocking)
| Severity | File | Finding |
|---|---|---|
| MEDIUM | design.md:144 |
RD-FR-027 supersession reconciliation has no executable owner (architect) |
| MEDIUM | design.md:145 |
Archive step lacks authority over other changes' requirements (guard) |
| LOW | specs/review-dispatch/spec.md:9 |
RD-CR prefix band lacks numbering-note convention (architect) |
| LOW | index.ts:4622 |
Internal dispatchAgentRun resolves correlation via shared latest-wins map (guard) |
| LOW | tasks.md:112 |
website#319 docs-gate half not recorded in tasks.md (architect) |
Full details in inline comments. CI: all 11 checks pass. Pre-flight: all local tools covered by CI.
This review was generated by /uf.review-pr (AI-assisted).
| and still applies to direct run calls joining an existing session. | ||
| RD-FR-027's "Session metadata refreshed on re-dispatch" scenario | ||
| remains satisfiable through direct run calls; its fix-loop | ||
| example is superseded by RD-CR-001's self-contained-iteration |
There was a problem hiding this comment.
MEDIUM — spec-integrity: The reconciliation D4 assigns to "the archive step" has no executable owner. The delta contains no MODIFIED Requirements section for RD-FR-027, and no tasks.md task edits the registry requirement. OpenSpec archive syncs only the archiving change's own delta, so after #751 and this change both archive, the registry carries contradictory guidance (replace-with-latest vs self-contained iteration) in a family whose IDs are load-bearing for review-dispatch recovery. The retrospective learning openspec-20261023T120157 documents this gap and prescribes the fix — a MODIFIED Requirements section for RD-FR-027 in this delta (viable since R6 documents this change archives after #751) or an explicit tasks.md item that edits the registry requirement at archive time.
| RD-FR-027's "Session metadata refreshed on re-dispatch" scenario | ||
| remains satisfiable through direct run calls; its fix-loop | ||
| example is superseded by RD-CR-001's self-contained-iteration | ||
| scenario, and the archive step should reconcile that example. |
There was a problem hiding this comment.
MEDIUM — spec-consistency: The cleanup D4 defers to "the archive step" has no owner with authority over another change's requirements: no MODIFIED Requirements section for RD-FR-027 in this delta and no tasks.md task edits the registry requirement. The retrospective learning documents the remediation; applying it here (a MODIFIED Requirements section or an explicit archive-time task) closes the gap.
|
|
||
| ### Requirement: Dispatch Session Correlation Lifecycle | ||
|
|
||
| **ID: RD-CR-001** This requirement MUST be satisfied. |
There was a problem hiding this comment.
LOW — spec-conventions: The new prefix band RD-CR-001..003 departs from the family's allocation-managed namespace (RD-FR-001..008, 009..018 reserved, 019..024 review-matrix with an explicit numbering note, 025..027 fix-review-dispatch-recovery, DR-FR-001..003 dispatch-recovery) without a numbering note. Continuing as RD-FR-028+ or adding the note keeps the registry convention intact.
| // that dispatch no runs (all-skip or prompt failure) pointing at a | ||
| // session-less correlation, so later no-provenance retrieval fails closed | ||
| // as not_found instead of returning the previous workflow's payload. | ||
| const correlationId = randomUUID() |
There was a problem hiding this comment.
LOW — session-isolation: Internal dispatchAgentRun calls resolve correlation by re-reading the shared sessionCorrelationMap after the per-invocation mint re-points it. Concurrent interleaved aggregate invocations from one parent session could persist run A's records under session B while reporting A's own correlation_id. All current command flows are sequential, so no live workflow is affected, and D6 documents the deferral. Threading the minted correlation to the internal run calls as a function parameter removes the residual.
| self-describing artifacts (I). | ||
| - [x] 5.4 Add the change entry to `CHANGELOG.md` (user-facing | ||
| dispatch behavior change). | ||
| - [x] 5.5 File the in-repo documentation issue for the |
There was a problem hiding this comment.
LOW — documentation-gate: Task 5.5 records only the in-repo documentation-issue half (#808) of the documentation gate. The unbound-force/website#319 half — executed during the review-council fix iteration and cited in the CHANGELOG — has no tasks.md task, so the archived record understates the four-task docs-gate template from #751 (tasks 8.4-8.7). Adding a task that records the website-issue half preserves the template.
Summary
Per-invocation dispatch correlation for the review-dispatch plugin (issue
#794; symptoms #760/#746). Each
dispatch_review_runsinvocation now mintsa fresh correlation ID immediately after input validation and persists its
prompts, run files, and session metadata under its own dispatch session
directory, re-pointing
sessionCorrelationMapto the latest dispatch — soconsecutive workflows from one conversation (unleash spec-then-code review,
address-feedback per-item dispatches, consecutive triage/review-pr runs) get
isolated sessions instead of clobbering each other, and prior sessions
survive as an audit trail retrievable by explicit
correlation_id.The dispatch output reports
correlation_idon every post-validation returnpath (all-skip, prompt-failure, success, budget-exhaustion), making each
session explicitly addressable, symmetric with the read-side D3 control.
The fix loop (D5) is preserved by reframing — each iteration is already a
full re-dispatch, so each becomes a self-contained session; the recovery
tools (DR-FR-001/002) are untouched; direct
dispatch_agent_runfan-outsemantics are unchanged (RD-CR-003).
The scaffold twin is synced byte-identical; 16 net-new + 1 rewritten
regression tests cover the #794 reproduction and fail-closed semantics;
shared test fixtures were extracted to
.opencode/test/helpers/aggregate-dispatch-fixtures.ts; CHANGELOG entryadded; docs issues filed in both repos (in-repo #808,
unbound-force/website#319).
Closes #794
How to Test
Run the gate suite from the repo root:
make plugin-test— 39 files, 1244 tests, 95.3% statements (94% floor)make check— lint, go test -race (all 13 packages), build, coveragegate, plugin tests
bash council-review-action/test/test-pipeline.sh— 91 assertions(CI parity)
go test -race -count=1 ./internal/scaffold/...— scaffold-twin driftdetection (byte-identical mirror)
Key regression scenarios covered by the new tests:
dispatch_review_runsinvocations from one parent session mintdistinct correlations with distinct session dirs; the first session's
run files and metadata survive the second invocation (the review-dispatch: sessionCorrelationMap never releases the per-conversation correlation ID (root cause of #760 / #746) #794
reproduction).
no-provenance retrieval fails closed as
not_found; an explicitcorrelation_idstill retrieves the earlier payload.correlation_idon everypost-validation return path (renders "none" for pre-parse validation
failure).
dispatch_agent_runfan-out shares one session; a direct callafter an aggregate dispatch joins the latest aggregate session.
How to Demo
In one opencode conversation, run two consecutive review dispatches (e.g.
/uf.unleashspec review then code review, or two/uf.triage-issueruns): each
dispatch_review_runsresult now reports its owncorrelation_id, anddispatch_status/consolidate_dispatchwith thefirst invocation's explicit
correlation_idstill returns that session'sruns after the second workflow has run — no more clobbered sessions or
stranded findings.
Key Files Changed
.opencode/plugins/review-dispatch/index.ts— per-invocationcorrelation mint, session-dir persistence,
correlation_idreportingon all return paths (+97)
internal/scaffold/assets/opencode/plugins/review-dispatch/index.ts—scaffold twin, synced byte-identical (+97)
.opencode/test/dispatch-review-runs.test.ts— review-dispatch: sessionCorrelationMap never releases the per-conversation correlation ID (root cause of #760 / #746) #794 reproduction andfail-closed semantics (rewritten, 549)
.opencode/test/helpers/aggregate-dispatch-fixtures.ts— extractedshared dispatch fixtures (new, 247)
.opencode/test/dispatch-agent-run.test.ts,consolidate-dispatch.test.ts,dispatch-status.test.ts—latest-dispatch resolution, direct fan-out, post-aggregate joining
CHANGELOG.md— correlation release entryopenspec/changes/fix-review-dispatch-correlation-release/—proposal, design, spec delta, tasks
.uf/dewey/learnings/— 12 retrospective learnings from the workflowKnown Issues
re-points
sessionCorrelationMap, but an invocation's internaldispatchAgentRuncalls still resolve their correlation by re-readingthe shared map. If two aggregate invocations from the same parent
session interleave (A mints C_A, B re-points the map to C_B, then A's
internal runs execute), A's runs would persist under C_B's session
while A reports C_A — a self-inconsistent result. Sequential
invocations (the supported pattern) are unaffected.
spec-delta ID numbering, archive reconciliation notes, docs-gate
coverage); docs issues were filed in both repos (Document per-invocation dispatch correlation lifecycle (fix-review-dispatch-correlation-release) #808,
docs: per-invocation dispatch correlation lifecycle (unbound-force#794 fix) website#319) to close the documentation gaps.
This PR was generated by /uf.finale (AI-assisted).