Skip to content

Bedrock Mantle without the AWS SDK — #35 with environment credentials - #37

Open
alexshapalov wants to merge 2 commits into
mainfrom
review/bedrock-mantle-no-sdk
Open

Bedrock Mantle without the AWS SDK — #35 with environment credentials#37
alexshapalov wants to merge 2 commits into
mainfrom
review/bedrock-mantle-no-sdk

Conversation

@alexshapalov

Copy link
Copy Markdown
Contributor

Carries #35 by @edwardsb (commit 2998a37, unchanged) plus one commit that removes the AWS SDK dependency per the maintainer's decision to keep pgbot's no-vendor-SDK rule. See the discussion on #35.

What stays from #35: GPT/Claude routing, the regional Mantle endpoint restriction, redirect refusal, the bearer-token format, and the tests (including the golden signature from AWS's reference generator, which now pins the standard-library presigner to the same output).

What changes: credentials come from AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_SESSION_TOKEN (bounded by AWS_CREDENTIAL_EXPIRATION), which aws configure export-credentials --format env produces for any profile, SSO login, or assumed role. AWS_BEARER_TOKEN_BEDROCK and PGBOT_AI_API_KEY still work as before. No profiles, config files, STS, SSO, or instance metadata. Binary size 30.0 MB back to 26.9 MB; go.mod gains nothing.

The contributor's fork is organization-owned, so this could not be pushed to #35's branch. Merging this lands #35's commit and marks it merged.

Closes #35.

🤖 Generated with Claude Code

https://claude.ai/code/session_013qGZKWgfGTBCoHsDjy1SuB

edwardsb and others added 2 commits September 6, 2026 18:10
…onment credentials

Reworks #35 per the maintainer's decision to keep the no-vendor-SDK rule. The
routing (openai.* via the Responses API, anthropic.* via the Messages API),
regional endpoint restriction, redirect refusal, token format, and tests are
the contributor's; what changes:

- aws-sdk-go-v2 and its 13 transitive modules are gone (binary back from 30.0
  to 26.9 MB). Bedrock's bearer token is a SigV4 query-presigned URL, so it is
  minted by ~100 lines over crypto/hmac; the PR's golden-signature test from
  AWS's reference generator pins the two implementations to the same token.
- Credentials come only from the environment: AWS_ACCESS_KEY_ID,
  AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, with AWS_CREDENTIAL_EXPIRATION
  (emitted by `aws configure export-credentials --format env`) bounding the
  token. No profiles, config files, STS, SSO, or instance metadata. The
  missing-credentials error names the export command.
- The "no vendor SDKs" package doc, the fantasy/binary-size rationale, and the
  "keys only from the environment, enforced once" doc are restored, with
  Bedrock added; README and CHANGELOG describe the environment model.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013qGZKWgfGTBCoHsDjy1SuB
@edwardsb

edwardsb commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Thanks for building on this. I’m happy with keeping the implementation SDK-free, but environment-only credentials leave a gap for my deployment: pgbot will run as a long-lived MCP server in ECS using its task IAM role.

ECS exposes those credentials through AWS_CONTAINER_CREDENTIALS_RELATIVE_URI, rather than injecting access keys directly. Exporting credentials at startup would work initially, but they’d eventually expire.

Would you be open to adding ECS task-role credential retrieval and automatic refresh using the standard HTTP client? We could keep profile/SSO resolution out of scope and preserve the no-SDK approach while supporting unattended ECS deployments.

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