Skip to content

[codex] Fix dream provenance and AI SDK v6 tool loop#868

Closed
swftwolfzyq wants to merge 2 commits into
garrytan:masterfrom
swftwolfzyq:codex/gbrain-upstream-fixes
Closed

[codex] Fix dream provenance and AI SDK v6 tool loop#868
swftwolfzyq wants to merge 2 commits into
garrytan:masterfrom
swftwolfzyq:codex/gbrain-upstream-fixes

Conversation

@swftwolfzyq

@swftwolfzyq swftwolfzyq commented May 11, 2026

Copy link
Copy Markdown

Summary

  • Make dream provenance slug collection robust when subagent_tool_executions.input is stored as either JSONB objects or JSON strings.
  • Adapt the chat gateway tool-loop plumbing to AI SDK v6 by using jsonSchema(...), converting persisted tool-result blocks into SDK output envelopes, and preserving reasoning blocks.

Why

The dream synthesize/patterns flow previously queried input ? 'slug', which misses production rows where tool input is a JSON string. That can make brain_put_page provenance look empty even after pages were written.

The chat gateway also still passed v5-style tool schema and raw persisted tool-result blocks into generateText, which breaks the v6 tool loop contract.

Validation

  • /home/hermes/.bun/bin/bun test test/ai/gateway-chat.test.ts
  • /home/hermes/.bun/bin/bun run typecheck
  • /home/hermes/.bun/bin/bun test test/tool-provenance.test.ts test/ai/gateway-chat.test.ts test/cycle-synthesize.test.ts test/e2e/dream-synthesize-pglite.test.ts

View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

@garrytan

garrytan commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Thanks for this contribution — and apologies for the slow triage. We did a full pass over the entire PR backlog. gbrain has moved fast, and the maintainer's larger "cathedral" rewrites have superseded a big share of community PRs: the AI gateway + recipes + user_provided_models system replaced almost all individual provider PRs; #1805 fixed the whole Postgres module-singleton class; #1542 unified the type taxonomy; #1657 the retrieval path; #1802 the doctor; and so on.

We're closing this one in that cleanup — either the fix already landed on master, it duplicates another PR or merged change, or it's outside the current merge bar. Where a closed PR carried a genuinely valuable idea, we've recorded it in docs/designs/COMMUNITY_IDEAS.md so nothing good is lost (a few may graduate into TODOs).

Please don't read the close as a judgment of the work — thank you for contributing. If you believe the underlying issue is still live on the latest master, reopen with a quick note and we'll take another look. 🙏

@garrytan garrytan closed this Jun 8, 2026
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.

2 participants