Skip to content

Credential Transport Abstraction [Spec + Impl] - #11

Merged
rhuss merged 2 commits into
mainfrom
079-credential-transport
Jul 11, 2026
Merged

rhuss merged 2 commits into
mainfrom
079-credential-transport

Conversation

@rhuss

@rhuss rhuss commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implementation of Credential Transport Abstraction. Migrates all credential detection and resolution from hardcoded profile maps to the agent-declared CredentialSpec model through the shared internal/credential package.

Key changes:

  • Removed deprecated KnownProviderProfiles map from openshell/credentials.go
  • Removed deprecated BuildCredentialSet/detectAuthMode from ssh/credentials.go
  • Migrated OpenShell workspace credential flow to use credential.Resolve() + credential.InjectOpenShell()
  • Migrated SSH workspace credential flow to use credential.DetectAll() + credential.InjectSSH()
  • Added OpenShellClientAdapter to bridge v1.ClientInterface to credential.OpenShellClient
  • 886 lines of deprecated code removed

Artifacts

  • Spec: specs/079-credential-transport/spec.md
  • Plan: specs/079-credential-transport/plan.md
  • Tasks: specs/079-credential-transport/tasks.md

Assisted-By: 🤖 Claude Code


Open in Devin Review

Summary by CodeRabbit

  • New Features

    • Workspace OpenShell provisioning and SSH session startup now automatically detect and merge available credential sources, improving multi-agent and multi-file scenarios.
    • Credential refresh now injects the merged credentials over SSH and explicitly handles the “no credentials detected” case.
  • Bug Fixes

    • Credential injection failures are now surfaced as warnings rather than blocking session startup.
  • Documentation

    • Added credential transport abstraction specs, plans, research notes, review findings, and a readiness checklist.

Assisted-By: 🤖 Claude Code
@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@rhuss, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 21 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 913db8f3-7ecf-4065-b84f-c13b1ad17d4c

📥 Commits

Reviewing files that changed from the base of the PR and between 8f99f09 and d61453f.

📒 Files selected for processing (15)
  • brainstorm/idea-inbox.md
  • cc-deck/internal/cmd/ws.go
  • cc-deck/internal/openshell/credentials.go
  • cc-deck/internal/openshell/credentials_test.go
  • cc-deck/internal/ssh/credentials.go
  • cc-deck/internal/ssh/credentials_test.go
  • cc-deck/internal/ws/openshell.go
  • cc-deck/internal/ws/openshell_test.go
  • cc-deck/internal/ws/ssh.go
  • specs/079-credential-transport/checklists/requirements.md
  • specs/079-credential-transport/plan.md
  • specs/079-credential-transport/research.md
  • specs/079-credential-transport/review-findings.md
  • specs/079-credential-transport/spec.md
  • specs/079-credential-transport/tasks.md
📝 Walkthrough

Walkthrough

Credential handling for OpenShell and SSH workspaces now uses shared internal/credential detection, resolution, merging, and injection flows. Legacy SSH credential helpers are removed, an OpenShell client adapter is added, and migration documentation and tests are updated.

Changes

Credential transport migration

Layer / File(s) Summary
OpenShell adapter and provider transport
cc-deck/internal/openshell/credentials.go, cc-deck/internal/openshell/credentials_test.go, cc-deck/internal/ws/openshell.go, cc-deck/internal/ws/openshell_test.go
Adds the OpenShell adapter and rewires provider selection, credential resolution, and post-start injection through internal/credential.
SSH credential injection and legacy removal
cc-deck/internal/ssh/credentials.go, cc-deck/internal/ssh/credentials_test.go, cc-deck/internal/ws/ssh.go, cc-deck/internal/cmd/ws.go
Removes legacy SSH credential helpers and switches workspace attachment and credential refresh to detect, merge, and inject credentials.
Supporting fixture and limitation note
cc-deck/internal/cmd/nonroot-write.txt, brainstorm/idea-inbox.md
Adds a write-test fixture entry and documents multi-file credential handling.
Migration specification and verification documents
specs/079-credential-transport/*
Adds requirements, planning, research, task, checklist, and review-findings documents for the credential transport migration.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Workspace as OpenShellWorkspace
  participant Credential as internal/credential
  participant Provider as OpenShellProviders
  participant Adapter as OpenShellClientAdapter
  Workspace->>Credential: Detect and resolve credentials
  Workspace->>Provider: Ensure mapped provider
  Workspace->>Credential: InjectOpenShell credentials
  Credential->>Adapter: Execute or upload credential data
  Adapter->>Provider: Delegate OpenShell SDK operation
Loading

Possibly related PRs

  • cc-deck/cc-deck#7: Updates the OpenShell credential transport interface implemented by this PR's adapter.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: a credential transport abstraction spanning both specification and implementation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 079-credential-transport

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

rhuss added a commit that referenced this pull request Jul 11, 2026
Applied fixes from bot review comments:
- Comment #3541838890: Remove accidental test artifact nonroot-write.txt
- Comment #3541855097: Error on explicit auth mode mismatch instead of silent continue
- Comment #3541855104: Include UnsetVars in credential injection gate
- Comment #3541855119: Fix Vertex test setup in spec to match assertion
- Comment #3541855124: Align FR-007/FR-008 with actual migration target

Assisted-By: 🤖 Claude Code
…specs

Replace hardcoded credential profile maps (KnownProviderProfiles in
openshell, BuildCredentialSet/detectAuthMode in ssh) with the shared
internal/credential package using agent-declared CredentialSpec data.

Key changes:
- OpenShell credential flow uses credential.Detect() + credential.Resolve()
  with OpenShellClientAdapter bridging the SDK client interface
- SSH credential flow uses credential.DetectAll() + credential.InjectSSH()
  with legacy fallback branch removed
- 886 lines of deprecated code removed from openshell/credentials.go
  and ssh/credentials.go
- Explicit auth mode mismatch now errors instead of silent continue
- UnsetVars included in credential injection gate

Spec: specs/079-credential-transport/

Assisted-By: 🤖 Claude Code
@rhuss
rhuss force-pushed the 079-credential-transport branch from 8f99f09 to d61453f Compare July 11, 2026 06:33
@rhuss
rhuss merged commit 6fba30f into main Jul 11, 2026
7 of 12 checks passed

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 6 additional findings in Devin Review.

Open in Devin Review

Comment on lines +292 to +297
case "api":
providerType = "claude"
creds = make(map[string]string)
for k, v := range resolved.EnvVars {
creds[k] = v
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 All credential environment variables are sent to the cloud provider instead of just the API key, potentially breaking provider creation

All resolved environment variables (including optional model-override flags) are copied into the provider credentials map (creds[k] = v at cc-deck/internal/ws/openshell.go:295-296) instead of only the API key, so the OpenShell provider receives unexpected keys like model overrides that it was never given before.

Impact: Provider creation may fail or behave unexpectedly when it receives unrecognized credential keys that the old code never passed.

Old code only passed the API key; new code passes everything

The old code built provider credentials via openshell.ResolveDefaultEnvVars("claude") which returned only ["ANTHROPIC_API_KEY"] (the DetectVars for the claude profile). The new code calls credential.Resolve(selectedSpec) which resolves ALL env vars in the spec (including optional ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL from cc-deck/internal/agent/claude.go:169-171), then mapToOpenShellProvider at lines 294-297 copies the entire map into provider credentials.

Additionally, these same env vars are also injected into the sandbox shell rc files via credential.InjectOpenShell() at line 412, resulting in double injection: once through the provider and once through shell rc files.

The fix should filter the credentials map in the "api" case to only include ANTHROPIC_API_KEY, matching the old behavior. The remaining env vars are correctly handled by the InjectOpenShell call later.

Suggested change
case "api":
providerType = "claude"
creds = make(map[string]string)
for k, v := range resolved.EnvVars {
creds[k] = v
}
case "api":
providerType = "claude"
creds = make(map[string]string)
if v, ok := resolved.EnvVars["ANTHROPIC_API_KEY"]; ok {
creds["ANTHROPIC_API_KEY"] = v
}
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

1 participant