Skip to content

[Improve] Show Zoo Code in outbound provider activity logs#219

Merged
edelauna merged 4 commits into
mainfrom
improve/outbound-identity-2tafayi62nl92
May 28, 2026
Merged

[Improve] Show Zoo Code in outbound provider activity logs#219
edelauna merged 4 commits into
mainfrom
improve/outbound-identity-2tafayi62nl92

Conversation

@roomote

@roomote roomote Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Related GitHub Issue

Closes: #203

Description

Some outbound requests from Zoo Code still identified themselves as Roo Code in provider-side activity and auth flows. The gaps were in paths that bypass the shared header helper or carry their own app metadata: OpenAI Codex, Unbound, Bedrock, the code-index embedders (Qdrant client), image generation requests, and the cloud auth/share package.

This PR updates all remaining hardcoded identity strings in those paths to use Zoo Code branding, adds regression coverage for each custom request path via focused unit tests, and adds e2e smoke tests that verify the correct identity headers reach the OpenRouter and Bedrock endpoints at the wire level.

Key implementation details:

  • openai-codex.ts / openai-native.ts: updated originator, User-Agent, and related fields in all three request paths (SDK path, fetch fallback, completePrompt())
  • unbound.ts: updated both X-Unbound-Metadata and unbound_metadata.originApp
  • qdrant-client.ts: updated User-Agent in both URL-based and host-based client construction paths
  • Bedrock e2e uses a custom h2c mock server (not aimock) because aimock's converse-stream builder nests payloads one level too deep, causing the AWS SDK deserializer to drop the delta field

Test Procedure

Unit tests:
```
pnpm test -- --testPathPattern="openai-codex|unbound|qdrant"
```

E2e smoke tests (mock mode, no credentials required):
```
cd apps/vscode-e2e && pnpm test --grep "identity-smoke"
```

The OpenRouter smoke test intercepts fetch at the origin level and asserts X-Title, HTTP-Referer, and User-Agent on every captured request for the task. The Bedrock smoke test starts a local h2c server, runs a task against it, and asserts the AWS SDK wrote ZooCode# into the user-agent header.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

N/A — no UI changes.

Documentation Updates

  • No documentation updates are required.

Additional Notes

The originator field on the Codex/OpenAI-native OAuth path was flagged as a potential registered client identifier. We've updated it to zoo-code consistent with the rest of the rename; if the Codex backend allowlists by originator and rejects zoo-code, that field can be held back independently without affecting any other identity change in this PR.

Get in Touch

Discord: edelauna

@roomote roomote Bot added the roomote:auto-resolve-conflicts Allow Roomote to auto-resolve merge conflicts for this PR label May 20, 2026
@roomote

roomote Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

2 issues outstanding. Action required. See task

  • src/api/providers/openai-codex.ts now sends originator and User-Agent as zoo-code for the SDK path, fetch fallback, and prompt completion path.
  • src/api/providers/unbound.ts now sends zoo-code in both X-Unbound-Metadata and unbound_metadata.originApp.
  • platform-unit-test (windows-latest) passed on commit 23fbb96.
  • apps/cli no longer migrates legacy provider: "roo" settings, so existing ~/.roo/cli-settings.json files now cause roo --print ... to exit with Invalid provider: roo.
  • apps/vscode-e2e/src/suite/providers/openrouter.test.ts still never ties captured requests to the openrouter-identity-smoke probe, so late/background OpenRouter traffic can still satisfy the assertions.
  • apps/vscode-e2e/src/suite/providers/bedrock.test.ts now inspects the outbound Bedrock request instead of only checking that the task completed.
  • apps/vscode-e2e/src/suite/providers/bedrock.test.ts now reads the mock-mode user-agent header instead of the absent x-amzn-user-agent header, so e2e-mock passes again.
  • apps/vscode-e2e/src/suite/providers/bedrock.test.ts now restores the default provider before closing the mock Bedrock server, so e2e-mock no longer times out in suite teardown.

Comment thread src/integrations/openai-codex/oauth.ts
Comment thread src/api/providers/constants.ts
@codecov

codecov Bot commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.10345% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/integrations/openai-codex/oauth.ts 0.00% 1 Missing ⚠️
.../services/code-index/vector-store/qdrant-client.ts 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@roomote

roomote Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main and fixed in bbc7d19. The remaining Codex and Unbound outbound identity gaps are addressed, the PR description is refreshed, and the matching review threads are resolved. See task

@roomote roomote Bot force-pushed the improve/outbound-identity-2tafayi62nl92 branch from 5849da5 to bbc7d19 Compare May 20, 2026 13:43
@edelauna edelauna force-pushed the improve/outbound-identity-2tafayi62nl92 branch from bbc7d19 to 23fbb96 Compare May 20, 2026 23:02
@edelauna

edelauna commented May 20, 2026

Copy link
Copy Markdown
Contributor

Wait for #123 to be merged, as it integrates the final Roo and Zoo renaming changes.

@proyectoauraorg proyectoauraorg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for finishing this off, @edelauna — this is a clean superset of what I had in #273, and the regression coverage for the Codex / Unbound / Bedrock custom paths is great to see. Two things worth a look before merge:

1. originator change on the Codex / OpenAI-native paths (possible auth impact).
This flips originator: "roo-code""zoo-code" in openai-codex.ts and openai-native.ts. Unlike User-Agent / HTTP-Referer / X-Title (free-form, safe to rebrand), originator on the Codex OAuth path can be a registered client identifier the ChatGPT/Codex backend recognizes. If roo-code is allowlisted server-side, switching it could get Codex auth/requests rejected. I deliberately kept it as roo-code in #273 for this reason. Could we confirm the backend accepts zoo-code as an originator before merging — or hold that one value back if it's uncertain?

2. One outbound path still identifies as Roo: qdrant-client.ts.
src/services/code-index/vector-store/qdrant-client.ts still sends "User-Agent": "Roo-Code" (2 spots) and isn't included here. If the goal is consistent outbound identity, worth folding it in too.

Everything else looks consistent and well-tested. Happy to help with either if useful. 🦘

@edelauna edelauna force-pushed the improve/outbound-identity-2tafayi62nl92 branch from 23fbb96 to 7eda7e6 Compare May 25, 2026 02:10
Comment thread apps/vscode-e2e/src/suite/providers/openrouter.test.ts Outdated
Comment thread apps/vscode-e2e/src/suite/providers/bedrock.test.ts Outdated
Comment thread apps/vscode-e2e/src/suite/providers/bedrock.test.ts Outdated
@edelauna edelauna force-pushed the improve/outbound-identity-2tafayi62nl92 branch from 7eda7e6 to c77e436 Compare May 25, 2026 02:47
Comment thread apps/vscode-e2e/src/suite/providers/bedrock.test.ts Outdated
@edelauna edelauna force-pushed the improve/outbound-identity-2tafayi62nl92 branch from c77e436 to 339e832 Compare May 25, 2026 13:11
@edelauna edelauna marked this pull request as ready for review May 28, 2026 22:05

@edelauna edelauna left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested locally

@edelauna edelauna added this pull request to the merge queue May 28, 2026
Merged via the queue into main with commit db07a23 May 28, 2026
16 checks passed
@edelauna edelauna deleted the improve/outbound-identity-2tafayi62nl92 branch May 28, 2026 22:46
zephg pushed a commit to zephg/Zoo-Code that referenced this pull request Jun 24, 2026
Brings in:
- chore: prepare v3.56.0 release (Zoo-Code-Org#398)
- fix: API requests hang indefinitely on VS Code 1.122.0+ (Zoo-Code-Org#383)
- feat: add Claude Opus 4.8 support across Anthropic, Bedrock, and Vertex (Zoo-Code-Org#386)
- Show Zoo Code in outbound provider activity logs (Zoo-Code-Org#219)

Conflict resolutions and adjustments below.

Anthropic Opus 4.8 (packages/types/src/providers/anthropic.ts)
--------------------------------------------------------------
Kept our effort-array shape from 64fc5fc (supportsReasoningEffort:
[low, medium, high, xhigh, max], default "high", requiredReasoningEffort:
true). Discarded upstream's binary supportsReasoningBudget +
supportsReasoningBinary shape -- the local fork uses effort-based
reasoning across all Anthropic Opus 4.x models (foundation: fd93c5b).

Vertex Opus 4.8 (packages/types/src/providers/vertex.ts)
--------------------------------------------------------
Upstream's verbatim Vertex 4.8 entry would emit a 400 in our codebase:
unlike Bedrock, Vertex has no provider-side adaptive-thinking guard, so
the registry shape alone decides the request payload. With
supportsReasoningBudget: true, our getAnthropicReasoning() would emit
{ thinking: { type: "enabled", budget_tokens } } -- which Opus 4.8
rejects.

Converted Vertex 4.8 to the same effort-array shape as our Anthropic 4.8
so the helper hits the adaptive/effort branch and emits
{ thinking: { type: "adaptive" }, output_config: { effort: "high" } }.

The pre-existing Vertex Opus 4.7 entry still uses the legacy budget
shape (also broken on the API). That's a known follow-up from fd93c5b
and intentionally out of scope for this merge.

Vertex provider (src/api/providers/anthropic-vertex.ts)
-------------------------------------------------------
Dropped upstream's explicit getAnthropicProviderReasoning() call in
getModel() and the associated import. Our getModelParams({format:
"anthropic"}) already returns params.reasoning via the unified
getAnthropicReasoning helper (post-fd93c5bde), so the explicit call
would duplicate the wiring and lose user-chosen efforts (upstream's
call site omits reasoningEffort).

Bedrock (src/api/providers/bedrock.ts, packages/types/src/providers/bedrock.ts)
------------------------------------------------------------------------------
Took upstream verbatim. The Bedrock provider has its own
isAdaptiveThinkingModel guard that overrides the request payload
regardless of registry shape, so the budget-shape registry entries are
fine here.

Tests (src/api/providers/__tests__/anthropic.spec.ts)
-----------------------------------------------------
Rewrote four upstream-added Opus 4.8 tests that asserted the
budget/binary shape to mirror our existing 4.7 effort-shape tests:
- "should use adaptive thinking ..." -> assert output_config.effort: "high"
- "should omit thinking when reasoning disabled" -> replaced with
  "should always emit adaptive thinking (reasoning is required)"
- "should preserve custom maxTokens" -> replaced with
  "should honor user-chosen effort" (matching our 4.7 pattern)
- "should handle Claude Opus 4.8 model correctly" -> assert
  supportsReasoningEffort array, default "high", requiredReasoningEffort

Verification
------------
- pnpm -w check-types: 11/11 packages clean
- pnpm -w test: 22 failures, all pre-existing in reasoning.spec.ts and
  model-params.spec.ts (matches MEMORY baseline from fd93c5b fixture
  drift). Zero new failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

roomote:auto-resolve-conflicts Allow Roomote to auto-resolve merge conflicts for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Outdated user-agent string

3 participants