sandbox-agent/docs
NathanFlurry c54f83e1a6
fix: credential detection and provider auth status (#120)
## Summary

Fix credential detection bugs and add credential availability status to the API. Consolidate Claude fallback models and add `sonnet` alias.

Builds on #109 (OAuth token support).

Related issues:
- Fixes #117 (Claude, Codex not showing up in gigacode)
- Related to #113 (Default agent should be Claude Code)

## Changes

### Credential detection fixes
- **`agent-credentials/src/lib.rs`**: Fix `?` operator bug in `extract_claude_credentials` - now continues to next config path if one is missing instead of returning early

### API credential status
- **`sandbox-agent/src/router.rs`**: Add `credentialsAvailable` field to `AgentInfo` struct
- **`/v1/agents`** endpoint now reports whether each agent has valid credentials

### OpenCode provider improvements
- **`sandbox-agent/src/opencode_compat.rs`**: Build `connected` array based on actual credential availability, not just model presence
- Check provider-specific credentials for OpenCode groups (e.g., `opencode:anthropic` only connected if Anthropic creds available)
- Add logging when credential extraction fails in model cache building

### Fallback model consolidation
- Renamed `claude_oauth_fallback_models()` → `claude_fallback_models()` (used for all fallback cases, not just OAuth)
- Added `sonnet` to fallback models (confirmed working via headless CLI test)
- Added `codex_fallback_models()` for Codex when credentials missing
- Added comment explaining aliases work for both API and OAuth users

### Documentation
- **`docs/credentials.mdx`**: New reference doc covering credential sources, extraction behavior, and error handling
- Documents that extraction failures are silent (not errors)
- Documents that agents spawn without credential pre-validation

### Inspector UI
- **`AgentsTab.tsx`**: Added credential status pill showing "Authenticated" or "No Credentials"

## Error Handling Philosophy

- **Extraction failures are silent**: Missing/malformed config files don't error, just continue to next source
- **Agents spawn without credential validation**: No pre-flight auth check; agent's native error surfaces if credentials are missing
- **Fallback models for UI**: When credentials missing, show alias-based models so users can still configure sessions

## Validation

- Tested Claude Code model aliases via headless CLI:
  - `claude --model default --print "say hi"` ✓
  - `claude --model sonnet --print "say hi"` ✓
  - `claude --model haiku --print "say hi"` ✓
- Build passes
- TypeScript types regenerated with `credentialsAvailable` field
2026-02-07 07:56:06 +00:00
..
ai fix: fix bun install bug (#62) 2026-02-02 21:12:41 -08:00
deploy docs: add Cloudflare Sandbox SDK deployment guide (#57) 2026-02-03 02:15:34 -08:00
images docs: documentation overhaul and universal schema reference (#10) 2026-01-28 05:07:15 -08:00
logo chore(site): links and image updates 2026-01-28 02:16:37 -08:00
sdks fix: fix bun install bug (#62) 2026-02-02 21:12:41 -08:00
building-chat-ui.mdx i need to update the terminology of 'capabilities' to 'feature coverage' in the inspector ui and anywhere else its mentioned thats not in the actual api (#61) 2026-02-02 19:00:35 -08:00
cli.mdx feat: model list (#96) 2026-02-06 02:59:23 -08:00
conversion.mdx feat: add Claude adapter improvements for HITL support (#30) 2026-01-29 07:19:10 -08:00
cors.mdx fix: correct inspector package name in Dockerfiles and add .dockerignore (#50) 2026-02-01 23:03:51 -08:00
credentials.mdx fix: credential detection and provider auth status (#120) 2026-02-07 07:56:06 +00:00
daemon.mdx feat: gigacode (#92) 2026-02-06 02:55:57 -08:00
docs.json fix: credential detection and provider auth status (#120) 2026-02-07 07:56:06 +00:00
favicon.svg chore(site): diagram mobile and favicon 2026-01-31 22:49:01 -08:00
gigacode.mdx chore: update readme (#98) 2026-02-06 03:03:24 -08:00
inspector.mdx fix: correct inspector package name in Dockerfiles and add .dockerignore (#50) 2026-02-01 23:03:51 -08:00
manage-sessions.mdx docs: documentation overhaul and universal schema reference (#10) 2026-01-28 05:07:15 -08:00
openapi.json fix: credential detection and provider auth status (#120) 2026-02-07 07:56:06 +00:00
opencode-compatibility.mdx chore: update readme (#98) 2026-02-06 03:03:24 -08:00
quickstart.mdx fix: fix bun install bug (#62) 2026-02-02 21:12:41 -08:00
session-transcript-schema.mdx feat: model list (#96) 2026-02-06 02:59:23 -08:00
telemetry.mdx docs: documentation overhaul and universal schema reference (#10) 2026-01-28 05:07:15 -08:00
theme.css docs: documentation overhaul and universal schema reference (#10) 2026-01-28 05:07:15 -08:00
troubleshooting.mdx fix: detect musl/glibc at runtime for correct Claude binary download 2026-01-28 04:19:35 -08:00