fix(tasks): route hogland agent through the LLM gateway, not direct Bedrock - #95658
Merged
Conversation
…edrock hogland boxes boot with the `bedrock` feature, which puts the Claude CLI in direct-Bedrock mode (CLAUDE_CODE_USE_BEDROCK=1). That path has hit a chain of Bedrock-specific failures (SigV4 header signing, then AWS Marketplace model-access denial) that Modal never sees because it routes through the PostHog LLM gateway. Unset the box's Bedrock env at agent launch so the CLI falls back to the gateway (ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN) the agent already configures — matching Modal and restoring gateway-based AI-observability attribution. Worker-side only; no golden re-bake needed.
|
😎 Merged successfully - details. |
Contributor
🤖 CI report
|
There was a problem hiding this comment.
Approved.
Contained, opt-in-only change (default False) for one sandbox backend, backed by unit tests, with no deny-listed CI/deploy/auth-of-users/dependency/schema surface touched; reverts to a previously working routing path.
- Author wrote 0% of the modified lines and has 7 merged PRs in these paths (familiarity MODERATE).
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 24L, 3F substantive, 42L/4F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (42L, 4F, single-area, fix) |
| stamphog 2.0.0b4 | .stamphog/policy.yml @ 1a3326a · reviewed head 1a3326a |
Contributor
|
/trunk merge |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
hogland task boxes fail because the in-box agent talks to AWS Bedrock directly — hogland boots boxes with the
bedrockfeature, which exportsCLAUDE_CODE_USE_BEDROCK=1. That direct-Bedrock path has hit a chain of Bedrock-specific failures that the Modal backend never sees:x-posthog-property-*custom headers (fixed in fix(agent): drop underscore-named custom headers on direct Bedrock #95455), and nowModal boxes don't use Bedrock; they route through the PostHog LLM gateway and work fine. hogland used the gateway too until the Bedrock rollout a few days ago.
Changes
env -u CLAUDE_CODE_USE_BEDROCK -u AWS_CONTAINER_CREDENTIALS_FULL_URI), so the Claude CLI falls back to the gateway (ANTHROPIC_BASE_URL/ANTHROPIC_AUTH_TOKEN) the agent already configures.build_agent_runtime_env_prefixgainsunset_bedrock;SandboxBase.disable_direct_bedrock(defaultFalse) is setTrueonHoglandSandbox; the launcher threads it through. Modal/Docker are unchanged.@posthog/agentpublish).How did you test this code?
test_hogland_sandbox.py, all pass locally):HoglandSandbox.disable_direct_bedrock is True; the env prefix emits-u CLAUDE_CODE_USE_BEDROCK -u AWS_CONTAINER_CREDENTIALS_FULL_URIwhenunset_bedrock=Trueand neither var by default.Docs update
Not needed.
🤖 Agent context
Autonomy: Human-driven (agent-assisted).
Follow-on to #95455. After the SigV4 header fix, hogland tasks hit a second, AWS-side Bedrock blocker (Marketplace model-access). Rather than chase each Bedrock-specific issue, this routes hogland tasks through the PostHog LLM gateway — the path Modal already uses successfully and that hogland itself used before the recent Bedrock rollout — which also fixes the AI-observability attribution gap direct Bedrock introduced. hogland's own design intends direct Bedrock (per-box AWS creds, no SaaS keys), so this is a deliberate tasks-product choice to opt our boxes out; worth a heads-up to the hogland team.