Skip to content

fix(dream): re-ask a oneshot prose skip for the JSON contract so it is banked (#9648) - #9651

Closed
Masashi-Ono0611 wants to merge 2 commits into
garrytan:masterfrom
Masashi-Ono0611:fix/issue-9648
Closed

Masashi-Ono0611 wants to merge 2 commits into
garrytan:masterfrom
Masashi-Ono0611:fix/issue-9648

Conversation

@Masashi-Ono0611

Copy link
Copy Markdown
Contributor

Related to #9648

When the oneshot synthesize child decides nothing meets the bar but answers in prose instead of the skip JSON, parseOneshotResponse returns null, the job falls through to the agentic loop, and under require_writes it dead-letters with no skip banked, so the same transcript is re-synthesized every cycle.

This change gives an unparseable, non-truncated, non-empty reply one bounded re-ask that restates the JSON contract (the call goes through the same rate lease and sub-budget). A parsed re-ask (skip or pages) continues through the existing validation and skip-banking path. If the re-ask is still unparseable, behavior is unchanged: the same unparseable fallback with the original attempt's token rollup (the re-ask's usage is still charged to the job). Truncated (length) and refused outputs are not re-asked.

The diff is mostly indentation: the lease + chat call moved into a local callOnce closure so it can run twice.

Test: test/minions/subagent-oneshot-prose-skip.test.ts (fails on base with a failed expect: outcome is fallback; passes with the fix). Existing oneshot and subagent-handler suites pass.

Siblings checked: the agentic-loop prose ending is untouched; no prose-to-skip heuristic is introduced.

Discrimination test

Discrimination test: reverted src/core/minions/handlers/subagent-oneshot.ts to dd2f111a4e17, ran bun test test/minions/subagent-oneshot-prose-skip.test.ts → fails without the fix. Restored → passes with the fix (T-0 recheck: proceed at master dd2f111; pass/fail counts were not captured by the T-0 runner).

Reproduced on latest master dd2f111 right before submission.

Verification

  • Not verified by this automated submission: any verify command or remediation text this PR adds was not run against a system in the broken state.

Tests

  • test/minions/subagent-oneshot-prose-skip.test.ts (added or changed by this PR)
  • bun test test/minions/subagent-oneshot-prose-skip.test.ts: fails without the fix, passes with it (T-0 recheck: proceed at master dd2f111; pass/fail counts not captured)

…s banked (garrytan#9648)

Related to garrytan#9648

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Nov 17, 2026

Copy link
Copy Markdown

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

Copy link
Copy Markdown

Thanks for this pull request, @Masashi-Ono0611. Here is how we handle outside pull requests, so you know what to expect:

  • Documentation people read (not files agents load, such as SKILL.md or AGENTS.md) can be merged as it is, after we check every link, command and install step in it.
  • Small, plainly correct fixes (under about 40 lines not counting tests, such as an error message or a typo) are taken even when the gain is small. We rebuild them on current master and credit you as co-author: the commit says Contributed by @Masashi-Ono0611 and carries a Co-Authored-By: trailer with your name. We land at most one of these a day, so it can take a few days.
  • Everything else, including all other code and anything that runs, we read as a detailed bug report. When we take it, we rebuild it on current master with the same credit.

When we rebuild a change, we close this PR with a link to the PR that landed it. When we don't take one, we close it with a short note saying why and what would change our answer. So apart from documentation, "closed, not merged" is the normal outcome and doesn't mean your work was turned down.

For a larger change, show us:

  • a way to reproduce the problem on current master, or a failing test;
  • what goes wrong for someone using gbrain because of it;
  • the version you saw it on (gbrain version).

A limit of 3 open pull requests applies only to someone whose recent pull requests have mostly been closed without being taken. It never applies to anyone who has had a pull request taken (merged or rebuilt) in the last 90 days.

More in CONTRIBUTING.md, "How an outside pull request is handled": https://github.com/garrytan/gbrain/blob/master/CONTRIBUTING.md#how-an-outside-pull-request-is-handled

This comment comes from the fix-wave gate check. It is red on every outside pull request by design, and a maintainer clears it when merging a documentation change.

…ytan#9648)

Related to garrytan#9648

Hold the oneshot child to the JSON contract with one re-ask so a prose skip is banked instead of dead-lettering.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@capy-ai

capy-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Thanks for this, @Masashi-Ono0611. It gives the oneshot dream synthesis one re-ask for the JSON skip when the model answers in prose, so the skip is recorded and the transcript isn't paid for again every cycle (#9648). That was fixed on the main branch in #9840, which takes the same approach of asking once more for the JSON skip, and it's in v0.60.749.0 and later. So I'm closing this one. If a prose skip still dead-letters on a release with that change, reply here with what you see.

@capy-ai capy-ai Bot closed this Nov 22, 2026
@capy-ai

capy-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Thank you. Your approach here went into #9840, and it should have been credited there; we've added that note to #9840.

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.

1 participant