Skip to content

feat(cli): distinguish stored accounts in auth list - #59783

Open
lancy69 wants to merge 2 commits into
anomalyco:devfrom
lancy69:auth-list-identity
Open

lancy69 wants to merge 2 commits into
anomalyco:devfrom
lancy69:auth-list-identity

Conversation

@lancy69

@lancy69 lancy69 commented Oct 28, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #59040

Design approval requested on the issue; still pending. Implementation prepared with OpenAI Codex assistance.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Append stable credential IDs to the auth table so same-label stored accounts are distinguishable. JSON output and environment connection handling remain intact.

How did you verify your code works?

Bun 1.4.4, from packages/cli:

  • bun test --timeout 30000 test/auth.test.ts: 13 passed, 0 failed.
  • bun typecheck: passed.
  • Oxlint on the changed implementation and test: 0 warnings/errors.

Actual CLI against an isolated authenticated server verified distinct IDs for two accounts labeled work, preserved JSON without secret values, and an environment connection shown with - rather than a stored ID. Switching and logging out by ID targeted only the selected credential. Reproduce by importing two same-label credentials, running opencode auth list, then using an ID with auth switch or auth logout.

Upstream full CI currently requires maintainer approval before jobs can run; the existing green checks cover PR metadata only.

Screenshots / recordings

Plain CLI output change; verified through command output.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Public API: adds a credential ID column to the default opencode auth list table output (JSON output unchanged)

@lancy69
lancy69 marked this pull request as ready for review October 30, 2026 07:03
@lancy69

lancy69 commented Oct 30, 2026

Copy link
Copy Markdown
Author

Ready for review after local verification: 13 auth regressions, CLI typecheck, changed-file lint, and an isolated CLI/server smoke passed. The new CI workflows report action_required before any jobs start. Could a maintainer approve the workflow runs? Design approval requested in #59040 is still pending.

@opencodejr opencodejr 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.

Works as described. I ran opencode auth list from source against a mock server returning two credentials with the same label: on the base they print as identical rows, and with this change they show distinct IDs, with - for the environment connection. test/auth.test.ts passes and tsc -b is clean.

Public API: the default text output of opencode auth list gains a fourth column (credential ID, or -). --format json is unchanged, as are all flags and commands. Scripts that parse the table by splitting on whitespace will see an extra field; the JSON output is the stable interface for those.

One thing worth fixing before merge: the rewritten test drops an existing check that is unrelated to this feature (see inline comment).

Comment thread packages/cli/test/auth.test.ts Outdated
}
return new Response("Not found", { status: 404 })
}, requests)
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This rewrite drops the requests capture and the assertion that /api/model/default is requested before /api/integration. That was the only test of the readiness ordering loadIntegrations depends on (see the comment in auth/shared.ts), and it has nothing to do with the new column. Could you keep it (pass requests back to authServer and restore the indexOf check)? As written, authServer's requests parameter is also left unused.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Restored in f070bb3: the test passes requests to authServer, checks that /api/model/default was requested, and asserts it precedes /api/integration. The JSON command completes and its ordering is checked before the table command starts, so concurrent requests cannot mask the assertion. Verified with bun test --timeout 30000 test/auth.test.ts (13 passed, 82 assertions), bun typecheck, and oxlint (0 warnings/errors).

@opencodejr opencodejr 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.

The earlier point is fixed: the test again passes requests to authServer and checks that /api/model/default is requested before /api/integration. Running the JSON and table commands one after the other keeps that check about the JSON run only. test/auth.test.ts passes and tsc -b is clean. Public API: unchanged since the last review (the default opencode auth list table gains a credential ID column; JSON output is unchanged). No new concerns.

This branch has not been deployed

No 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.

auth list hides subpath identity and shows duplicate rows for distinct auth records

1 participant