Skip to content

fix(dag): capture final answers and deliver parent reports once - #736

Merged
LeXwDeX merged 16 commits into
mainfrom
fix/dag-final-output-integration
Oct 11, 2026
Merged

LeXwDeX merged 16 commits into
mainfrom
fix/dag-final-output-integration

Conversation

@LeXwDeX

@LeXwDeX LeXwDeX commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Issue for this PR

Closes #735

Type of change

  • Bug fix
  • Documentation

What does this PR do?

Why

DAG workers could report through a tool and then answer again, while the parent received a truncated preview and started another model turn to repeat the result.

Scope

Complete DAG final-response capture and parent report delivery, preserve historical workflows, and cover CLI receipt baselines, concurrent parent input, transactional events, and workflow mutation/recovery. Include the next stable release notes.

What changed

New workflows persist final_response: capture the complete final assistant text or validate one final JSON value, without submit_result or a resubmission nudge. Historical workflows retain their existing protocol. The selected delivery node or unique terminal synthesis node returns its report verbatim once; receipts and wake markers commit atomically. Actionable pause, failure, timeout, and clarification handling continues through the existing parent decision path. The CLI renders each new durable answer before exiting, whether consumed from a local event or fetched during idle polling, including mixed and multiple workflows. Adds 1.0.69 release notes. The final head integrates the independently reviewed Hooks PR #738 so native checks validate both features together; #738 merged first as 17a42b5da4877fed73ca3bdc6405592890d759c9 and its Issue #737 closed.

The report and wake now use one top-level EventV2 transaction, so a rollback emits no visible report event. Structured results retain all fields, including JSON string quotes, empty strings, and objects shaped like managed file references. Failed or unfinished parent replies cannot consume a pending user request, including long tool conversations. A stale final-response validation failure preserves fresh parent input through continuation, while execution failures retain their existing semantics. Workflow extension and recovery update delivery selection without changing historical explicit non-leaf choices. The CLI retries unknown baseline reads and distinguishes verified absence from transient errors.

Approach

Keep the durable protocol and public event shapes compatible. Reuse the mailbox freshness guard, existing EventV2 projections and per-event commit hook, and canonical session ordering. Add regression cases against the real database and event stream rather than only mocked transcript writes.

Acceptance

Full final answers remain intact, delivery receipts and wakes commit together, rollback/restart does not duplicate reports, pending input survives stale validation, and extended/recovered workflows select current results. The CLI requires its current process to render newly delivered answers before exit. Native required checks must pass on the final head before merge.

How did you verify your code works?

Evidence

  • Current-source final delivery regressions: 31 passed, 109 assertions. Twelve added cases cover strings, empty strings, null, false, zero and file-reference-shaped objects with and without original source text. Before the fix, six cases reproduced the delivery loss. Mutation and stale-input regressions: 16 passed, 49 assertions across two files. Expanded DAG regressions: 101 passed, 451 assertions; core mailbox regressions: 30 passed, 296 assertions.
  • Joint delivery, CLI receipt, CLI process and runtime event-manifest regressions: 49 passed, 213 assertions. CLI receipt unit tests alone: 18 passed, 81 assertions.
  • bun run typecheck: 31/31 workspace tasks passed. bun run lint: 4739 warnings, zero errors, existing cap 4750.
  • bun run test:dag-core: core 153, runtime 945 (2 opt-in skips), schema 3 and TUI 63 passed; all existing coverage floors passed. Current app Chromium and TUI report rendering each passed.
  • Final combined brain review passed on the complete 44-file diff, including all six review fixes and the schema delivery correction. Reviewed content is now committed as a158e6b7e8096a0ab0c5336f7946ab80b8337e36; its diff SHA-256 against main 4e86f7f95f72720e57aeb84db2d2b93dc6f0a29d is e5da2ee895ea60bc242b23acad0b1660214b50bc68b2c850165d39a2c0e0d038. Native Typecheck, Linux unit and both E2E platforms will be verified on this final head before merge.
  • Initial product acceptance on source commit cff1423773e52b40b56c8bd53f4cae235c028c41 included installed CLI and isolated Qwen, GLM and DeepSeek checks. These preceded the current review fixes and are not claimed as live acceptance of this final head.
  • Final integrated-source Qwen, GLM and DeepSeek acceptance each passed 39 assertions: two completed nodes, zero submit_result calls, one parent answer, and preserved receipts after restart. The local test build 0.0.0-dag-final-output.3 passed its build and version smoke test (SHA-256 c78591ada3b3e5a1dd1b0543ff5320e8d49bc3801dfb9bd6cf1c650cfd85e5be). Administrator permissions blocked installation over /usr/local/bin/opencode; the final live tests used development source, not the old installed binary.
  • Final integrated-source Hooks self-authoring acceptance passed with Qwen: one user prompt, zero driver hook registrations, the built-in skill loaded, model-authored hook/script, 2.266907 seconds confirmed idle before the fresh nonce resumed the original session, and no repeat for 6 seconds. Cleanup preserved the user's configuration and removed temporary credentials and owned processes.
  • The workflow tool schema snapshot is synchronized with both result protocols and optional delivery selection; its focused regressions previously passed 61 tests, 18 snapshots and 73 assertions.
  • Pinned toolchain: Bun 1.4.2, Node 24.21.0, Go 1.27.1. Stable artifact verification is handled by the release pipeline after both this PR and the separate Hooks PR fix: complete hook guidance and teach asyncRewake #738 merge.
  • Four subsequent review findings are fixed in final HEAD b0d563ab62341e0ae4046a245a298b2cb90808f0: conditional missing-snapshot recovery failure, explicit rejection of start-only replan fields, completed local-command admission, and identical CLI/runtime config parsing. All four threads have a fix explanation and are resolved.
  • Final-source verification after those fixes: runtime package typecheck passed; four-file regressions 89 passed / 334 assertions; CLI process, system and hook event coverage 45 passed / 98 assertions; complete DAG gate core 153 / runtime 961 (2 skips) / schema 3 / TUI 63 passed, including no SDK regeneration drift; lint 4739 warnings / zero errors. Commit and push hooks also passed workspace typecheck (31/31 tasks) and the pinned toolchain check.
  • Qwen, GLM and DeepSeek source acceptance was repeated separately on that content: each passed 39 assertions with two nodes, zero reporting-tool calls, one parent answer, and preserved receipts after restart. Test binary 0.0.0-dag-final-output.4 passed version smoke; SHA-256 7bd541f1a1dc48271d26307a35bac3f841e66c2b7b9ef4166e6b2ef12b1230b7. This remains source live acceptance, not installed-binary acceptance.
  • Final incremental brain review passed for the nine-file delta and direct impact area. Committed combined diff SHA-256 against 4e86f7f95f72720e57aeb84db2d2b93dc6f0a29d is 16c05906e4e2d310ca61ff68ee52ae41bf53ce96cad55065b8a1f6051582448d, identical to reviewed content. Release notes now distinguish earlier and repeated final-source evidence. New-head native CI is pending and remains mandatory before merge.

Latest Three Delivery Review Fixes

  • Final HEAD: 2c3a4b8471cc1a8fe503a96dbf44f1b62115e0f1. Recognizes historical ended synthetic/ignored goal and subgoal dispatch failures, rejects pending-user and already-stale episodes before large report artifacts are written, and renders durable receipts without assuming cross-process event delivery. Source and answer are rendered in order and deduplicated against later events; idle polling retains one pending stream read and aborts the subscription before iterator cleanup. All three new review threads have fix explanations and are resolved.
  • On this content, bun test --timeout 30000 test/cli/run/dag-hold.test.ts test/dag/dag-final-delivery.test.ts test/cli/run/run-dag-hold-process.test.ts passed 80 tests / 298 assertions: 47 delivery, 23 receipt, and 10 real CLI process tests. Workspace typecheck passed 31/31 tasks. Full DAG gate passed core 153 / runtime 969 (2 opt-in skips) / schema 3 / TUI 63, with unchanged coverage floors and no SDK generation drift. Lint passed at 4739 warnings / zero errors; formatting, diff checks and release-note rendering passed. Commit/push hooks repeated lint, workspace typecheck and the pinned toolchain check.
  • Final six-file incremental brain review PASS. Committed delta SHA-256 against b0d563ab62341e0ae4046a245a298b2cb90808f0: 5a3b8a278713141d54f6213d7374791a560a70398511d19ff02d931b438002f5. Combined SHA-256 against 4e86f7f95f72720e57aeb84db2d2b93dc6f0a29d: cb26e7a82e1562b46f95ee1b156d284be6aa0bab151fd86c8ea0e2dd43c1beb9. Fingerprints match the reviewed content.
  • The live-model, Hooks self-authoring, app Chromium, and local test-binary evidence above preceded this last increment. Eventless SDK-receipt tests plus separate real CLI-process coverage are not claimed as a two-live-process integration test. Installed-binary acceptance remains blocked by administrator permissions.
  • Native CI passed on exact HEAD 2c3a4b8471cc1a8fe503a96dbf44f1b62115e0f1: Typecheck 5m30s (38102359146); Unit Tests (linux) 30m58s, E2E (linux) 2m18s, E2E (windows) 6m26s (38102359092). CodeQL also passed. Native required-check readback and SpecGit checks observation agree; all review threads are resolved. Earlier green heads are not used to satisfy final-head acceptance.

Screenshots / recordings

App Chromium and TUI regression harnesses verify the displayed report body and source marker.

Checklist

  • I have tested my changes locally.
  • I have not included unrelated changes in this PR.
  • Legacy workflow compatibility and restart delivery are covered.
  • Final ASTRA review completed.
  • Required Typecheck, Linux unit, Linux E2E, and Windows E2E checks pass on the final PR head.

@LeXwDeX
LeXwDeX marked this pull request as ready for review October 10, 2026 19:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T01:39:45.741212Z 2c3a4b8 New commits
🔒 Security Review ✅ Completed 2026-10-11T01:41:21.156758Z 2c3a4b8 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1dd9854a6d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/opencode/src/cli/cmd/run/dag-hold.ts Outdated
Comment thread packages/opencode/src/dag/runtime/report-delivery.ts Outdated
Comment thread packages/opencode/src/dag/runtime/spawn.ts Outdated
Comment thread packages/opencode/src/dag/runtime/report-delivery.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5afad3162a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/opencode/src/dag/runtime/report-delivery.ts Outdated
Comment thread packages/opencode/src/dag/runtime/report-delivery.ts
@LeXwDeX
LeXwDeX marked this pull request as draft October 10, 2026 20:16
Audit the built-in hook skills, command prompts and session guidance against
the runtime. Explain supported events, handlers, protocols and lifecycle
limits, and teach background polling that resumes an idle conversation.

Validate independent hook creation from a natural-language request with an
isolated Qwen session, including idle-to-rewake continuation and cleanup.
Both affected package typechecks and 59 focused tests passed.

Refs #737
@LeXwDeX
LeXwDeX marked this pull request as ready for review October 10, 2026 22:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a158e6b7e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/opencode/src/dag/runtime/recovery.ts
Comment thread packages/opencode/src/dag/validation.ts
Comment thread packages/opencode/src/dag/runtime/report-delivery.ts
Comment thread packages/opencode/src/cli/cmd/run/dag-hold.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b0d563ab62

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/opencode/src/dag/runtime/report-delivery.ts
Comment thread packages/opencode/src/dag/runtime/report-delivery.ts
Comment thread packages/opencode/src/cli/cmd/run/dag-hold.ts Outdated
@LeXwDeX
LeXwDeX merged commit 4356210 into main Oct 11, 2026
9 checks passed
@LeXwDeX
LeXwDeX deleted the fix/dag-final-output-integration branch October 11, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: capture DAG final answers and deliver reports once

1 participant