-
Notifications
You must be signed in to change notification settings - Fork 18
fix(adk): preserve agent spans for custom roots #734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,97 +1,169 @@ | ||
| --- | ||
| name: commit-message | ||
| description: Suggest a Braintrust SDK repo-style commit message from the current diff and conversation. Use when asked to write, suggest, or generate a commit message for the current changes. | ||
| description: Generates a meaningful conventional commit message (title + body) from the current diff and conversation context. Use when asked to write, suggest, or generate a commit message for the current changes. | ||
| --- | ||
|
|
||
| # Commit Message | ||
| # Commit Message Generator | ||
|
|
||
| Generate a single commit message that matches the style used on `main` in this repo. | ||
| Generate a conventional commit message based on the staged/unstaged diff and the surrounding conversation. | ||
|
|
||
| ## Repo Style | ||
| ## Conventional Commits Format | ||
|
|
||
| Prefer: | ||
| ``` | ||
| <type>(<scope>): <short summary> | ||
|
|
||
| <body> | ||
|
|
||
| ```text | ||
| <type>(<scope>): <summary> | ||
| <footer> | ||
| ``` | ||
|
|
||
| or, when scope does not add much: | ||
| **Types:** | ||
| - `feat` — new feature | ||
| - `fix` — bug fix | ||
| - `ref` — code restructuring without behavior change (prefer `ref` over `refactor`) | ||
| - `perf` — performance improvement | ||
| - `test` — adding or updating tests | ||
| - `docs` — documentation only | ||
| - `chore` — build system, tooling, dependencies, config | ||
| - `ci` — CI/CD pipeline changes | ||
| - `style` — formatting, whitespace (no logic change) | ||
| - `revert` — reverts a previous commit | ||
|
|
||
| **Rules:** | ||
| - Subject line ≤ 72 characters, lowercase, no trailing period | ||
| - Imperative mood: "add feature" not "added feature" | ||
| - Body wraps at 100 characters, explains *what* and *why* (not *how*) | ||
| - Footer: `BREAKING CHANGE: ...` or `Fixes #<issue>` / `Closes #<issue>` if applicable | ||
| - Scope is optional but encouraged when it adds clarity (e.g., `feat(auth):`, `fix(api):`) | ||
| - Omit body if the subject line fully communicates the intent | ||
|
|
||
| ## Writing Style | ||
|
|
||
| - Lead with the point. Be direct, technical, collaborative, and lightly casual. | ||
| - Use plain words, contractions where natural, and short paragraphs. | ||
| - Prefer `we` for shared decisions and `I` for genuine opinion or uncertainty. Do not hide uncertainty behind authoritative prose. | ||
| - Ground claims in specifics: name the API, version, behavior, error, test, or file involved. | ||
| - Put code, identifiers, filenames, versions, and literal values in backticks. | ||
| - Give only the context needed to explain **context → change → reason/evidence → consequence or follow-up**. | ||
| - Surface compatibility constraints, tradeoffs, risks, and intentionally deferred work plainly when relevant. | ||
| - Use bullets for multiple distinct changes or findings; avoid unnecessary headings and polished filler. | ||
| - Do not merely restate the diff. Explain why the implementation matters or how behavior changes. | ||
|
|
||
| For a substantive change, actively consider including a compact code snippet, before/after example, or ASCII diagram when it explains behavior or data flow more clearly than prose. Keep it focused and omit it when it would be decorative or redundant. For example: | ||
|
|
||
| ````text | ||
| Before: provider response -> wrapper-specific span | ||
| After: provider response -> shared integration hook -> normalized span | ||
| ```` | ||
|
|
||
| or: | ||
|
|
||
| ````python | ||
| # Before | ||
| wrap(client) | ||
|
|
||
| # After | ||
| client = wrap_client(client) | ||
| ```` | ||
|
|
||
| ## Instructions | ||
|
|
||
| 1. **Collect the diff** — run `git diff HEAD` (staged + unstaged). If empty, try `git diff --cached` (staged only). If still empty, try `git status --short` and `git log --oneline -3` to understand the trajectory. | ||
|
|
||
| 2. **Review the conversation** — you already have the conversation history in context. Look for: | ||
| - Explicit intent from the user ("I'm adding X", "this fixes Y") | ||
| - Issue or ticket numbers mentioned | ||
| - Feature names, module names, or domain language used | ||
| - Any constraints or things the user emphasized | ||
|
|
||
| 3. **Identify ambiguities** — before generating, check if any of these are unclear: | ||
| - Is the primary intent a new feature, a fix, a refactor, or something else? | ||
| - Is there a scope (module/package/component) worth calling out? | ||
| - Are there breaking changes? | ||
| - Is there a related issue or ticket number? | ||
| - Does the diff span multiple unrelated concerns? (should be split into separate commits) | ||
|
|
||
| 4. **Ask for clarifications if needed** — if the intent is genuinely ambiguous from both the diff and the conversation, ask 1–3 focused questions before generating. Do **not** ask about things already clear from the context. | ||
|
|
||
| 5. **Generate the commit message** — produce exactly one commit message in a fenced code block: | ||
| - Pick the most specific `type` that fits | ||
| - Include a `scope` when it meaningfully narrows the change | ||
| - Write a crisp subject line in imperative mood | ||
| - Add a body if the change is non-trivial, explaining the reasoning | ||
| - Check whether a small before/after snippet or ASCII diagram would make a substantive change easier to review, and include one when it would | ||
| - Add footer entries for breaking changes or issue references | ||
| - **CRITICAL when committing:** preserve **real newline characters** in the commit body | ||
| - **Never** put literal `\n` text inside a quoted `git commit -m "..."` body and assume Git will turn it into line breaks — it will not | ||
| - If issuing `git commit` yourself, prefer these patterns in this order: | ||
| 1. **Best for multiline bodies:** write the full message to a temp file and use `git commit -F <file>` | ||
| 2. **Good for amendments:** write the full message to a temp file and use `git commit --amend -F <file>` | ||
| 3. multiple `-m` flags, e.g. `git commit -m "subject" -m "first paragraph | ||
|
|
||
| second paragraph"` | ||
| 4. ANSI-C quoting, e.g. `git commit -m "subject" -m $'line 1\n\nline 2'` | ||
| - Prefer temp-file commits by default whenever the body has multiple paragraphs, bullets, or any non-trivial formatting | ||
| - Before finalizing, sanity-check that `git log -1 --format=medium` shows actual blank lines and wrapped paragraphs, not backslash-n sequences | ||
|
|
||
| ## Newline safety examples | ||
|
|
||
| **Wrong:** | ||
|
|
||
| ```text | ||
| <type>: <summary> | ||
| ```bash | ||
| git commit -m "docs: add pi guide" -m "line 1\n\nline 2" | ||
| ``` | ||
|
|
||
| Recent `main` examples: | ||
| This stores the characters `\` and `n` literally in the commit message. | ||
|
|
||
| - `feat(openai): trace images api calls` | ||
| - `fix(framework): split \`Output\` TypeVar into \`Output\` and \`Expected\`` | ||
| - `ref(litellm): migrate litellm wrapper to integrations API` | ||
| - `chore: generated SDK types` | ||
| - `ci(checks): bump nox shards to 4 and introduce shard weights` | ||
| - `test(openai): add vcr regression coverage for stream helpers` | ||
| - `docs: document integrations in readme` | ||
| - `perf(json): reduce span serialization overhead` | ||
| **Correct:** | ||
|
|
||
| Notes: | ||
| ```bash | ||
| git commit -m "docs: add pi guide" -m $'line 1\n\nline 2' | ||
| ``` | ||
|
|
||
| - This repo uses `ref`, not `refactor`. | ||
| - Scope is common and usually names the subsystem, provider, or area being changed. | ||
| - Commits on `main` often include a GitHub squash suffix like `(#245)`. Omit that for a normal local commit unless the user explicitly wants a PR title or squash-merge title. | ||
| - This repo commonly uses commit bodies for substantive changes. Prefer a concise subject that makes the main change obvious, and add a short body unless the change is truly trivial and fully explained by the subject. | ||
| or | ||
|
|
||
| ## Types | ||
| ```bash | ||
| git commit -m "docs: add pi guide" -m "line 1 | ||
|
|
||
| Use the most specific type: | ||
| line 2" | ||
| ``` | ||
|
|
||
| - `feat` — new feature | ||
| - `fix` — bug fix | ||
| - `ref` — restructuring without behavior change | ||
| - `perf` — performance improvement | ||
| - `test` — tests only | ||
| - `docs` — documentation only | ||
| - `chore` — tooling, generated files, maintenance, config | ||
| - `ci` — GitHub Actions, nox sharding, CI wiring | ||
| - `style` — formatting only | ||
| - `revert` — reverting a prior change | ||
| or use a temp file/editor. | ||
|
|
||
| ## Scope Guidance | ||
| ## Default execution preference | ||
|
|
||
| Good scopes in this repo usually look like: | ||
| When the task is not just to suggest a commit message, but to actually run `git commit` or `git commit --amend`: | ||
|
|
||
| - provider or integration names: `openai`, `anthropic`, `google_genai`, `claude_agent_sdk`, `langchain` | ||
| - SDK areas: `framework`, `cli`, `devserver`, `integrations` | ||
| - CI/tooling areas: `checks`, `nox`, `release` | ||
| 1. If the message has a body, prefer a temp file with `-F` | ||
| 2. If amending a commit with a body, prefer `git commit --amend -F <file>` | ||
| 3. Only use inline `-m` bodies when the formatting is trivially simple and you are certain real newlines will be preserved | ||
| 4. After committing, verify with `git log -1 --format=medium` | ||
|
|
||
| If the change is broad or generated, omit scope instead of forcing one. | ||
| This preference exists to avoid malformed commit bodies with literal `\n` sequences. | ||
|
|
||
| ## Rules | ||
| ## Output Format | ||
|
|
||
| - Keep the message useful but concise. | ||
| - Keep the subject concise and imperative. | ||
| - Prefer lowercase style and no trailing period. | ||
| - Keep the subject around 72 characters or less when practical. | ||
| - Describe the primary change, not every file touched. | ||
| - Make the subject specific enough that a reviewer can understand the change without opening the diff. | ||
| - If the diff mixes unrelated concerns, say so instead of forcing one message. | ||
| - Add a short body by default for feature, fix, perf, or ref commits. | ||
| - The body should briefly capture why the change was made, any important behavioral detail, and key test/coverage notes when they materially help a reviewer. | ||
| - Only omit the body when the change is truly tiny and the subject fully explains it. | ||
| Present the final message in a fenced code block. If the message contains its own fenced snippet, use a longer outer fence so the full message remains copyable: | ||
|
|
||
| ## Workflow | ||
| ``` | ||
| feat(auth): add OAuth2 PKCE flow for CLI login | ||
|
|
||
| 1. Inspect the current change: | ||
| Replace the device-code flow with PKCE so the CLI can authenticate | ||
| without opening a browser on headless machines. The previous flow | ||
| required interactive browser consent which blocked CI usage. | ||
|
|
||
| ```bash | ||
| git diff HEAD | ||
| git diff --cached | ||
| git status --short | ||
| Closes #342 | ||
| ``` | ||
|
|
||
| 2. Pick the main intent, choose `type` and optional `scope`, then write one useful but concise commit message. | ||
| 3. Unless the change is trivial, include a body with 1-3 short paragraphs or bullets covering rationale, behavior, or test coverage. | ||
| Then briefly (1–2 sentences) explain the key decision made (type choice, scope, whether a body was needed). | ||
|
|
||
| ## Output | ||
| If you asked for clarifications and the user answered, incorporate those answers and output the final message immediately — no need to re-ask. | ||
|
|
||
| Return exactly one commit message in a fenced code block. | ||
| ## Commands | ||
|
|
||
| If helpful, add one short sentence after the block explaining the type/scope choice. | ||
| ```bash | ||
| git diff HEAD | ||
| git diff --cached | ||
| git status --short | ||
| git log --oneline -5 | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...egrations/adk/cassettes/1.14.1/test_adk_custom_base_agent_root_preserves_agent_spans.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| interactions: | ||
| - request: | ||
| body: '{"contents": [{"parts": [{"text": "Say hello."}], "role": "user"}, {"parts": | ||
| [{"text": "For context:"}, {"text": "[custom_root] said: step"}], "role": "user"}], | ||
| "systemInstruction": {"parts": [{"text": "Reply with only the word hello.\n\nYou | ||
| are an agent. Your internal name is \"child\"."}], "role": "user"}, "generationConfig": | ||
| {}}' | ||
| headers: | ||
| Content-Type: | ||
| - application/json | ||
| user-agent: | ||
| - google-genai-sdk/1.75.0 gl-python/3.14.6 google-adk/1.14.1 gl-python/3.14.6 | ||
| x-goog-api-client: | ||
| - google-genai-sdk/1.75.0 gl-python/3.14.6 google-adk/1.14.1 gl-python/3.14.6 | ||
| method: POST | ||
| uri: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent | ||
| response: | ||
| body: | ||
| string: "{\n \"candidates\": [\n {\n \"content\": {\n \"parts\": | ||
| [\n {\n \"text\": \"hello\"\n }\n ],\n | ||
| \ \"role\": \"model\"\n },\n \"finishReason\": \"STOP\",\n | ||
| \ \"index\": 0\n }\n ],\n \"usageMetadata\": {\n \"promptTokenCount\": | ||
| 37,\n \"candidatesTokenCount\": 1,\n \"totalTokenCount\": 38,\n \"promptTokensDetails\": | ||
| [\n {\n \"modality\": \"TEXT\",\n \"tokenCount\": 37\n | ||
| \ }\n ],\n \"serviceTier\": \"standard\"\n },\n \"modelVersion\": | ||
| \"gemini-2.5-flash-lite\",\n \"responseId\": \"5vyaatfQE_3A39IPhsvziAE\"\n}\n" | ||
| headers: | ||
| Alt-Svc: | ||
| - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 | ||
| Content-Type: | ||
| - application/json; charset=UTF-8 | ||
| Date: | ||
| - Fri, 04 Sep 2026 17:16:22 GMT | ||
| Server: | ||
| - scaffolding on HTTPServer2 | ||
| Server-Timing: | ||
| - gfet4t7; dur=362 | ||
| Transfer-Encoding: | ||
| - chunked | ||
| Vary: | ||
| - Origin | ||
| - X-Origin | ||
| - Referer | ||
| X-Content-Type-Options: | ||
| - nosniff | ||
| X-Frame-Options: | ||
| - SAMEORIGIN | ||
| X-Gemini-Service-Tier: | ||
| - standard | ||
| X-XSS-Protection: | ||
| - '0' | ||
| content-length: | ||
| - '552' | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
58 changes: 58 additions & 0 deletions
58
...aintrust/integrations/adk/cassettes/2.6.3/test_adk_binary_data_attachment_conversion.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| interactions: | ||
| - request: | ||
| body: '{"contents": [{"parts": [{"inlineData": {"data": "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs-9AAAAFElEQVR42mP4z8DwnxjMMKqQvgoBksPHOXvuG4oAAAAASUVORK5CYII=", | ||
| "mimeType": "image/png"}}, {"text": "What color is this image?"}], "role": "user"}], | ||
| "systemInstruction": {"parts": [{"text": "You are a helpful assistant that can | ||
| analyze images.\n\nYou are an agent. Your internal name is \"vision_agent\"."}], | ||
| "role": "user"}, "generationConfig": {"maxOutputTokens": 150}}' | ||
| headers: | ||
| Content-Type: | ||
| - application/json | ||
| user-agent: | ||
| - google-genai-sdk/2.22.0 gl-python/3.14.6 google-adk/2.6.3 gl-python/3.14.6 | ||
| x-goog-api-client: | ||
| - google-genai-sdk/2.22.0 gl-python/3.14.6 google-adk/2.6.3 gl-python/3.14.6 | ||
| method: POST | ||
| uri: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent | ||
| response: | ||
| body: | ||
| string: "{\n \"candidates\": [\n {\n \"content\": {\n \"parts\": | ||
| [\n {\n \"text\": \"The image is red.\"\n }\n | ||
| \ ],\n \"role\": \"model\"\n },\n \"finishReason\": | ||
| \"STOP\",\n \"index\": 0\n }\n ],\n \"usageMetadata\": {\n \"promptTokenCount\": | ||
| 291,\n \"candidatesTokenCount\": 5,\n \"totalTokenCount\": 296,\n \"promptTokensDetails\": | ||
| [\n {\n \"modality\": \"TEXT\",\n \"tokenCount\": 33\n | ||
| \ },\n {\n \"modality\": \"IMAGE\",\n \"tokenCount\": | ||
| 258\n }\n ],\n \"serviceTier\": \"standard\"\n },\n \"modelVersion\": | ||
| \"gemini-2.5-flash-lite\",\n \"responseId\": \"W_yaav_8LIOl1MkPq_u00Q8\"\n}\n" | ||
| headers: | ||
| Alt-Svc: | ||
| - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 | ||
| Content-Type: | ||
| - application/json; charset=UTF-8 | ||
| Date: | ||
| - Fri, 04 Sep 2026 17:14:04 GMT | ||
| Server: | ||
| - scaffolding on HTTPServer2 | ||
| Server-Timing: | ||
| - gfet4t7; dur=399 | ||
| Transfer-Encoding: | ||
| - chunked | ||
| Vary: | ||
| - Origin | ||
| - X-Origin | ||
| - Referer | ||
| X-Content-Type-Options: | ||
| - nosniff | ||
| X-Frame-Options: | ||
| - SAMEORIGIN | ||
| X-Gemini-Service-Tier: | ||
| - standard | ||
| X-XSS-Protection: | ||
| - '0' | ||
| content-length: | ||
| - '638' | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.