Skip to content

feat(credentials): support Codex and Claude Code subscription authentication #432

Description

@KurosawaGeeker

Area

Runtime

Problem

mosoo currently requires an App owner to enter a provider API key before an Agent can use Codex or Claude Code. Users who already have an eligible Codex or Claude Code subscription must maintain a separate API credential and billing path, which adds setup friction and makes local/self-hosted usage harder.

Manually copying CLI auth files, browser cookies, or short-lived tokens into an Environment is not an acceptable workaround: it is fragile, difficult to revoke, easy to leak through snapshots or logs, and bypasses mosoo's App-scoped credential boundary.

Proposal

Add subscription-backed credential connections for:

  • Codex, using a provider-supported ChatGPT/Codex subscription login flow where available.
  • Claude Code, using a provider-supported Claude subscription login flow where available.

The App owner should be able to connect, inspect, reconnect, test, and revoke each subscription credential from the Providers surface. Agent configuration should explicitly select an authentication mode such as api_key or subscription; mosoo must not silently fall back between modes.

Subscription credentials should reuse the existing App-scoped vault boundary:

  • Store refresh/session material encrypted at rest and show only a masked account subject and connection status.
  • Resolve credentials only for the owning App and execution actor.
  • Materialize the minimum provider-specific auth state into the Sandbox only for the runtime that needs it, with restrictive file permissions and cleanup on teardown/reset.
  • Never include auth state in Agent packages, Environment artifacts, checkpoints, logs, diagnostics, transcripts, or public API responses.
  • Surface actionable states such as connected, expired, revoked, unsupported subscription, and reauthorization required.

Implementation must use provider-supported authentication mechanisms and respect provider terms and deployment constraints. It must not scrape browser cookies, extract unrelated local credentials, or emulate unsupported OAuth clients.

Acceptance criteria

  • An App owner can connect Codex and Claude Code subscription credentials without entering an API key, when the provider officially supports the selected deployment mode.
  • An Agent can explicitly select either an App-scoped API-key credential or an App-scoped subscription credential.
  • A valid subscription credential can start the matching runtime without requiring an API key.
  • Expired, revoked, unsupported, or insufficient-entitlement credentials fail closed with an actionable reconnect/error state.
  • Credentials cannot be resolved across Apps and are never silently inherited from the host machine or another Agent.
  • Runtime injection is ephemeral and provider-specific; secret material is excluded from packages, snapshots/checkpoints, logs, diagnostics, and API responses.
  • Revoking a connection prevents future runs from using it.
  • Focused tests cover connection lifecycle, App isolation, runtime materialization/cleanup, redaction, and existing API-key compatibility.
  • Documentation explains supported subscription plans, deployment modes, provider limitations, and the reconnect/revoke flow.

Alternatives considered

  • Keep requiring API keys. This is simple but preserves duplicate setup and billing friction for subscription users.
  • Ask users to place local CLI auth files in Environment setup scripts or variables. This weakens credential isolation and risks leaking secrets into reusable artifacts.
  • Mount the entire host home directory into the Sandbox. This grants excessive access and does not work safely for cloud or multi-tenant deployments.

Compatibility and migration

This should be additive. Existing provider API-key credentials, Agent configurations, manifests, and runtime behavior remain valid and unchanged. No existing Agent should switch authentication modes automatically.

Subscription connections remain App-owned and must not be exported with Agent packages. Unsupported providers, plans, or deployment modes should remain unavailable rather than falling back to host credentials.

Contribution

I can provide product feedback

Checklist

  • I searched existing issues before opening this request.
  • I described the problem before the proposed solution.
  • I kept this request focused on one improvement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions