claude-connector: authenticate the Claude child with an API key (config auth field) #3

Merged
eureka merged 11 commits from hands/connector-api-key into main 2026-11-29 17:36:26 +00:00
Owner

Ruling eureka-body:ruling:swarm-on-api-key (with claude-connector-via-claude-code).

  • Config: new typed field auth (key 23) on the connector document, oauth-token or api-key; config init --auth (default oauth-token). It names which credential token_credential holds. One choice per connector. A document written before the field is refused at load (canonical-form check) until the installer authors it again.
  • Route: the key goes to the child on the same pipe as the token (fd 3), announced by CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR (present in the pinned claude 2.1.312 binary; same reader as the OAuth variable). Never env, argv or logs. The OAuth variable is not set in key mode.
  • Meter: in key mode no meter thread starts, stream rate_limit_events do not feed QuotaCell, the cell stays empty, no lease waits for a first read, and nothing is refused for a plan.
  • Tests: key reaches the child by pipe (real process), not in env/argv/sink/result/debug; OAuth unchanged; cell empty in key mode; missing key fails before spawn and is not ready; config round trip, flag, old-document refusal.
  • Known: backend::tests::the_meter_call_reads_the_week_from_a_real_captured_event fails on main too (its fixture window reset 2026-11-09 has passed); untouched here.
  • Note: the CLI also caches the credential at $CLAUDE_CONFIG_DIR/.api_key (as it does .oauth_token) inside the connector's own config_dir.
  • Lease callers: the lease pipe lends the configured credential unchanged; a Self-run consumer would receive a key, not a token.

🤖 Generated with Claude Code

Ruling eureka-body:ruling:swarm-on-api-key (with claude-connector-via-claude-code). - Config: new typed field `auth` (key 23) on the connector document, `oauth-token` or `api-key`; `config init --auth` (default oauth-token). It names which credential `token_credential` holds. One choice per connector. A document written before the field is refused at load (canonical-form check) until the installer authors it again. - Route: the key goes to the child on the same pipe as the token (fd 3), announced by `CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR` (present in the pinned claude 2.1.312 binary; same reader as the OAuth variable). Never env, argv or logs. The OAuth variable is not set in key mode. - Meter: in key mode no meter thread starts, stream rate_limit_events do not feed QuotaCell, the cell stays empty, no lease waits for a first read, and nothing is refused for a plan. - Tests: key reaches the child by pipe (real process), not in env/argv/sink/result/debug; OAuth unchanged; cell empty in key mode; missing key fails before spawn and is not ready; config round trip, flag, old-document refusal. - Known: backend::tests::the_meter_call_reads_the_week_from_a_real_captured_event fails on main too (its fixture window reset 2026-11-09 has passed); untouched here. - Note: the CLI also caches the credential at $CLAUDE_CONFIG_DIR/.api_key (as it does .oauth_token) inside the connector's own config_dir. - Lease callers: the lease pipe lends the configured credential unchanged; a Self-run consumer would receive a key, not a token. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eureka merged commit 80c1fc6a69 into main 2026-11-29 17:36:26 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/ModelConnector!3
No description provided.