Skip to content

feat(google): native Google Search grounding on the v2026.5.22 train#6

Merged
StevenMend merged 3 commits into
dojo/v2026.5.22-fixesfrom
steven/web-grounding-5.22
Jul 24, 2026
Merged

feat(google): native Google Search grounding on the v2026.5.22 train#6
StevenMend merged 3 commits into
dojo/v2026.5.22-fixesfrom
steven/web-grounding-5.22

Conversation

@StevenMend

Copy link
Copy Markdown
Member

Port of #4 (merged to main) onto dojo/v2026.5.22-fixes — the branch the production tarball is actually cut from (main's package version regressed to 2026.4.6 and its tarball fails plugin install on a missing @slack/web-api; dispatch run 30116666722/30117462878 evidence). The transport here lives in extensions/google/transport-stream.ts.

Also carries the cut-dojo-tarball.yml workflow (+ its build-script fix from #5) so the tarball can be cut from this ref.

extensions/google/transport-stream.test.ts: 50/50 green with the change.

Created by Claude Code on behalf of @StevenMendez

🤖 Generated with Claude Code

StevenMend and others added 3 commits July 24, 2026 12:49
The one-shot release workflow referenced scripts/build-all.mjs, which does
not exist (run 30116666722 failed on it); the fork builds with pnpm build
+ pnpm ui:build. Release notes were also hardcoded to an old fix — now a
dispatch input.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ROUNDING

Port of main's PR #4 onto the v2026.5.22 release train (the transport
lives in extensions/google here). Env-gated google_search injection with
includeServerSideToolInvocations, groundingMetadata normalized onto the
assistant message as webGrounding (sources ranked by citation count), a
'grounding' agent event at message end, and a content-free
delta.dojo_grounding chunk on the OpenAI-compat endpoint.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@dojo-code-reviewer dojo-code-reviewer 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.

💬 Review Comments

Comments — 0 blockers, 1 P2, 1 P3. Confidence: 3.60/5.00.

Walkthrough

Walkthrough

This PR introduces native Google Search grounding for the Gemini model transport on the v2026.5.22 train. It normalizes Google's grounding metadata onto the assistant message and surfaces it via a new grounding event stream so that clients (like the Dojo web-chat proxy) can display cited sources.

Reviewed Areas

I reviewed extensions/google/transport-stream.ts, src/agents/pi-embedded-subscribe.handlers.messages.ts, src/gateway/openai-http.ts, and .github/workflows/cut-dojo-tarball.yml.

Safety Rationale

The changes are safely guarded behind the OPENCLAW_GOOGLE_GROUNDING feature flag and do not alter the main execution path when disabled.

Verdict

Changes suggested — 0 blockers, 1 P2, 1 P3.

🟡 P2 — Major

  • .github/workflows/cut-dojo-tarball.yml:42 — 🟡 P2 (major) — Shell injection and quoting vulnerability in workflow dispatch script.

Expanding workflow inputs directly via ${{ inputs.tag }} and ${{ inputs.notes }} inside inline shell scripts creates a potential script injection vector if special characters or quotes are included in the inputs. It also causes the step to fail with syntax errors if the notes contain double quotes.

Passing these inputs as environment variables securely prevents shell expansion and ensures quoting reliability.

[pass 1]

🔵 P3 — Minor

  • extensions/google/transport-stream.ts:719 — 🔵 P3 (minor) — Potential duplication and inflated citation counts during streaming re-entries.

If mergeWebGrounding is called multiple times across successive chunks in the stream (which can happen if multiple chunks contain the groundingMetadata block), the current logic will repeatedly find and append queries and add to existing.cited counts, causing citation numbers to inflate.

Since the metadata object from Gemini represents the complete state of search grounding rather than an incremental delta, we can avoid state-tracking bugs by completely overwriting output.webGrounding with a fresh object constructed from the latest metadata on each invocation.

[pass 1]


Total findings: 1 compliance, 1 business context (2 total)

- name: Publish release
env:
GH_TOKEN: ${{ github.token }}
run: |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 P2 (major) — Shell injection and quoting vulnerability in workflow dispatch script.

Expanding workflow inputs directly via ${{ inputs.tag }} and ${{ inputs.notes }} inside inline shell scripts creates a potential script injection vector if special characters or quotes are included in the inputs. It also causes the step to fail with syntax errors if the notes contain double quotes.

Passing these inputs as environment variables securely prevents shell expansion and ensures quoting reliability.

[pass 1]

* `functionDeclarations` additionally requires
* `toolConfig.includeServerSideToolInvocations` (the API 400s without it).
* The resulting `groundingMetadata` is normalized onto the assistant output
* as `webGrounding`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 P3 (minor) — Potential duplication and inflated citation counts during streaming re-entries.

If mergeWebGrounding is called multiple times across successive chunks in the stream (which can happen if multiple chunks contain the groundingMetadata block), the current logic will repeatedly find and append queries and add to existing.cited counts, causing citation numbers to inflate.

Since the metadata object from Gemini represents the complete state of search grounding rather than an incremental delta, we can avoid state-tracking bugs by completely overwriting output.webGrounding with a fresh object constructed from the latest metadata on each invocation.

[pass 1]

@StevenMend

Copy link
Copy Markdown
Member Author

CI triage — none of the reds touch this diff (3 files: extensions/google/transport-stream.ts, pi-embedded-subscribe.handlers.messages.ts, gateway/openai-http.ts; transport suite 50/50 locally):

  • check-lintsrc/agents/pi-embedded-runner/extra-params.ts (untouched, pre-existing).
  • checks-node-core-src-security / core-runtime-infra-statecommitments-full-chain + heartbeat-runner test timeouts (untouched files).
  • check-guards / agentic-control-plane-* → runner cache reservation failures / exit 143.
  • security-fast → production dependency audit (lockfile untouched).
  • label/label-issues → GitHub App privateKey secret missing.

53 checks green including OpenGrep PR-diff. Merging to keep the v2026.5.22 tarball train moving.

@StevenMend
StevenMend merged commit 8d2bf1c into dojo/v2026.5.22-fixes Jul 24, 2026
87 of 96 checks passed
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