Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/pr-account-cleanup-retry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ use <provider> <id> Switch the active credential; 'main' selects the Codex App l
refresh <provider> Force-refresh Codex or provider quota reports.
auto-switch <provider> <on|off|status|threshold N> Control the Codex pool threshold.
priority <provider> <id|main> [first|earlier|normal|later|last|-100..100|reset] Selection order; omit the value to read it.
remove <provider> <id> --yes Remove a stored account or key after an existence check.
remove <provider> <id|main> --yes [--cleanup-only] OAuth/API-key ids are checked first; Codex can retry orphan credential cleanup.
add-key <provider> [--label <label>] Add a key read only from piped stdin.
login/reauth/code/cancel Run browser or manual-code auth from a headless shell.
reset-credits <id|main> [--consume --yes] Inspect or consume Codex reset credits.
Expand Down Expand Up @@ -182,18 +182,23 @@ preemption が未バインドリクエストを直ちに引き上げます。既

ヘッドレス シェルからブラウザベースまたは手動コードのアカウント認証を実行します。プロバイダー固有のコマンド形式には `ocx account --help` を使用します。Codex account login は保存済みでも catalog refresh が保留中なら成功終了し、human output の stderr に固定の `ocx sync` 案内を出します。`--json` は案内を混ぜず、完了 state に `catalogRefreshPending: true` を保持します。

### `ocx account remove <provider> <id|main> --yes [--json]`
### `ocx account remove <provider> <id|main> --yes [--cleanup-only] [--json]`

この保護された非対話型削除には `--yes` が必要です。削除する前に、ID が存在することが確認されます。 ID が欠落している場合は、DELETE を送信せずに 1 が終了します。メインの Codex App ログインは削除できないため、`remove openai main --yes` は拒否されます。削除後、ファミリーは再度読み取られます。固定された Codex アカウントを削除すると、ピンがクリアされ、自動選択に戻ります。 OAuth は最初に残ったアカウントを昇格させるか、何も報告しません。 API キー プールは、最初に残っているキーを昇格するか、何も報告しません。 `--json` の成功と失敗の形状は次のとおりです。
この保護された非対話型削除には `--yes` が必要です。OAuth と API key の削除は DELETE を送る前に id の存在を確認します。Codex の削除は idempotent であり、中断したローカル credential cleanup を再試行できるよう、row がなくても DELETE を送ります。未知の id は server が 404 を返します。`accountCleanupPending` の後は `--cleanup-only` を追加します。この option は persisted account が存在しないことを確認できた場合のみ orphaned credential cleanup を完了するため、stale retry が再追加済み account を削除しません。メインの Codex App ログインは削除できないため、`remove openai main --yes` は拒否されます。削除後、ファミリーは再度読み取られます。固定された Codex アカウントを削除すると、ピンがクリアされ、自動選択に戻ります。 OAuth は最初に残ったアカウントを昇格させるか、何も報告しません。 API キー プールは、最初に残っているキーを昇格するか、何も報告しません。 `--json` の成功と失敗の形状は次のとおりです。

```text
{ ok: true, provider, id, removedActive: boolean, promotedActiveId: string | null, catalogRefreshPending?: boolean }
{ error: string } // stderr, exit 1
{ ok: true, provider, id, removedActive: boolean, promotedActiveId: string | null, catalogRefreshPending?: boolean, accountCleanupPending?: boolean }
{ error: string, catalogRefreshPending?: boolean, accountCleanupPending?: boolean } // stderr, exit 1
```

`catalogRefreshPending` は Codex 削除だけに含まれます。`true` でも削除は保存済みで、human output は
stderr に `ocx sync` の案内を出して終了コード 0 のままです。OAuth account と API key の削除形状は変わりません。

`accountCleanupPending` は Codex 削除の JSON にだけ含まれます。`false` はローカル credential cleanup の完了を示します。
`true` は account row と live ownership の削除は完了したものの、ローカル credential cleanup が完了していないことを示します。
human output は固定の `--cleanup-only` 案内を表示して終了コード 0 のままです。JSON output は stdout に警告を混ぜず、この flag を保持します。
成功した Codex DELETE の後に post-delete verification read が失敗した場合、command は終了コード 1 になりますが、JSON error は両方の Codex completion boolean を保持し、human output も必要な recovery guidance を表示します。

### `ocx account add-key <provider> [--label <label>] [--json]`

API キー プロバイダーのキーを追加してアクティブ化します。キーは、非 TTY パイプ/リダイレクトされた標準入力からの読み取り専用です。インタラクティブ TTY 入力、空の入力、OAuth/Codex プロバイダー、および API エラー終了 1。キーがラベル内に表示される場合も含め、キーがエコーされることはありません。シークレット マネージャーまたはヒア文字列を使用することをお勧めします。
Expand Down
9 changes: 8 additions & 1 deletion docs-site/src/content/docs/ja/reference/management-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Authorization: Bearer <admin-token>

|メソッドとパス |目的 |注目すべきエラー |
| --- | --- | --- |
| `GET, POST, DELETE /api/codex-auth/accounts` | Codex アカウントの一覧表示/更新、必要に応じてインポート、削除。成功した POST/DELETE は `catalogRefreshPending` を返します。 | 400 無効な入力。手動インポートは無効にすることができます。 |
| `GET, POST, DELETE /api/codex-auth/accounts` | Codex アカウントの一覧表示/更新、必要に応じてインポート、削除。成功した POST/DELETE は `catalogRefreshPending` を返し、DELETE は `accountCleanupPending: true` を返す場合もあります。 | 400 無効な入力。404 不明なアカウント。409 cleanup-only retry で account absence を確認できない。500 `codex_account_delete_rollback_failed` は再試行前に再起動が必要。手動インポートは無効にすることができます。 |
| `PUT /api/codex-auth/accounts/alias` |アカウント エイリアスの設定またはクリア | 400 無効なアカウント/エイリアス |
| `PUT /api/codex-auth/accounts/pause` | 1 つのアカウントを一時停止または再開する | 400 無効なアカウント/状態。 404 アカウントが見つかりません |
| `PUT /api/codex-auth/accounts/pause-exhausted` |クォータを使い果たしたアカウントを一時停止する |ミューテーションロックの失敗は 503 になります |
Expand Down Expand Up @@ -235,6 +235,13 @@ account 作成を再試行する前に再認証するか削除してください
保存済み mutation をロールバックせず、内部 provider/account/path/credential detail も返しません。削除した
account の selector binding は残るため、欠落中の exact route は fail closed し、同じ id の再追加で同じ selector が戻ります。

config の削除がコミットされた後にローカルの credential cleanup が完了できない場合でも、
DELETE は live ownership を無効化して catalog convergence を要求し、`accountCleanupPending: true` を含む
成功応答を返します。同じ DELETE を繰り返すと、account row が既に存在しなくても cleanup を再試行できます。
recovery client は `cleanupOnly=1` を追加します。この形式は persisted account absence を確認できない場合に 409 で拒否し、
stale retry が再追加済み account を削除しないようにします。dashboard は不透明な account id を公開せずこの安全な再試行
action を保持し、CLI は storage detail を公開せず固定の `--cleanup-only` 案内を表示します。

## クライアントの選択

通常の管理では、[ウェブダッシュボード](/guides/web-dashboard/) が最も安全なガイド付きワークフローを提供します。ヘッドレス ホストとオートメーションの場合は、対応する `ocx` コマンドを使用します。これらのコマンドは、これと同じライブ API を呼び出し、プロキシに到達できない場合、または操作が失敗した場合にゼロ以外の結果を返します。ダイレクト HTTP は、上記の正確なエンドポイント コントラクトを必要とする統合に最も役立ちます。
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ use <provider> <id> Switch the active credential; 'main' selects the Codex App l
refresh <provider> Force-refresh Codex or provider quota reports.
auto-switch <provider> <on|off|status|threshold N> Control the Codex pool threshold.
priority <provider> <id|main> [first|earlier|normal|later|last|-100..100|reset] Selection order; omit the value to read it.
remove <provider> <id> --yes Remove a stored account or key after an existence check.
remove <provider> <id|main> --yes [--cleanup-only] OAuth/API-key ids are checked first; Codex can retry orphan credential cleanup.
add-key <provider> [--label <label>] Add a key read only from piped stdin.
login/reauth/code/cancel Run browser or manual-code auth from a headless shell.
reset-credits <id|main> [--consume --yes] Inspect or consume Codex reset credits.
Expand Down Expand Up @@ -181,18 +181,23 @@ Codex pool 계정 하나의 선택 순서를 읽거나 설정합니다. **값이

헤드리스 셸에서 브라우저 기반 또는 수동 코드 계정 인증을 실행합니다. 제공자별 명령 형태는 `ocx account --help`를 보십시오. Codex account login이 저장되었지만 catalog refresh가 보류 중이면 성공으로 종료하고 human output의 stderr에 고정된 `ocx sync` 안내를 표시합니다. `--json`은 안내를 섞지 않고 완료 state의 `catalogRefreshPending: true`를 유지합니다.

### `ocx account remove <provider> <id|main> --yes [--json]`
### `ocx account remove <provider> <id|main> --yes [--cleanup-only] [--json]`

이 보호된 비대화형 삭제는 `--yes`를 요구합니다. 삭제하기 전에 id가 존재하는지 확인하며, 없는 id는 DELETE를 보내지 않고 종료 코드 1로 끝납니다. Codex App의 main 로그인은 제거할 수 없으므로 `remove openai main --yes`는 거부됩니다. 삭제 후에는 해당 계열을 다시 읽습니다. 고정된 Codex 계정을 제거하면 고정이 풀리고 자동 선택으로 돌아갑니다. OAuth는 남아 있는 첫 번째 계정으로 승격하거나 없다고 보고합니다. API 키 풀은 남아 있는 첫 번째 키로 승격하거나 없다고 보고합니다. `--json`의 성공 및 실패 형식은 다음과 같습니다:
이 보호된 비대화형 삭제는 `--yes`를 요구합니다. OAuth와 API key 삭제는 DELETE 전에 id 존재를 확인합니다. Codex 삭제는 idempotent하며 중단된 로컬 credential cleanup을 재시도할 수 있도록 row가 없어도 DELETE를 보냅니다. 알 수 없는 id는 server가 404를 반환합니다. `accountCleanupPending` 뒤에는 `--cleanup-only`를 추가합니다. 이 option은 persisted account가 없음을 확인할 수 있을 때만 orphaned credential cleanup을 완료하므로 stale retry가 다시 추가된 account를 삭제하지 않습니다. Codex App의 main 로그인은 제거할 수 없으므로 `remove openai main --yes`는 거부됩니다. 삭제 후에는 해당 계열을 다시 읽습니다. 고정된 Codex 계정을 제거하면 고정이 풀리고 자동 선택으로 돌아갑니다. OAuth는 남아 있는 첫 번째 계정으로 승격하거나 없다고 보고합니다. API 키 풀은 남아 있는 첫 번째 키로 승격하거나 없다고 보고합니다. `--json`의 성공 및 실패 형식은 다음과 같습니다:

```text
{ ok: true, provider, id, removedActive: boolean, promotedActiveId: string | null, catalogRefreshPending?: boolean }
{ error: string } // stderr, exit 1
{ ok: true, provider, id, removedActive: boolean, promotedActiveId: string | null, catalogRefreshPending?: boolean, accountCleanupPending?: boolean }
{ error: string, catalogRefreshPending?: boolean, accountCleanupPending?: boolean } // stderr, exit 1
```

`catalogRefreshPending`는 Codex 삭제에만 포함됩니다. `true`여도 삭제는 이미 저장되었으며 human output은
stderr에 `ocx sync` 안내를 표시하고 종료 코드 0을 유지합니다. OAuth account와 API key 삭제 형식은 바뀌지 않습니다.

`accountCleanupPending`는 Codex 삭제 JSON에만 포함됩니다. `false`는 로컬 credential cleanup이 완료되었음을 뜻합니다.
`true`는 account row와 live ownership은 제거되었지만 로컬 credential cleanup이 완료되지 않았음을 뜻합니다.
human output은 고정된 `--cleanup-only` 안내를 표시하고 종료 코드 0을 유지합니다. JSON output은 stdout에 경고를 섞지 않고 이 flag를 유지합니다.
성공한 Codex DELETE 뒤의 post-delete verification read가 실패하면 command는 종료 코드 1을 반환하지만, JSON error는 두 Codex completion boolean을 유지하고 human output도 필요한 recovery guidance를 계속 표시합니다.

### `ocx account add-key <provider> [--label <label>] [--json]`

API 키 제공자에 키를 추가하고 활성화합니다. 키는 비TTY 파이프/리디렉션 stdin에서만 읽습니다. 대화형 TTY 입력, 빈 입력, OAuth/Codex 제공자, API 실패는 종료 코드 1로 끝납니다. 라벨 안에 들어 있더라도 키는 절대 출력되지 않습니다. 비밀 관리자나 here-string을 쓰는 편이 좋습니다:
Expand Down
9 changes: 8 additions & 1 deletion docs-site/src/content/docs/ko/reference/management-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Authorization: Bearer <admin-token>

| Method and path | 목적 | 주요 오류 |
| --- | --- | --- |
| `GET, POST, DELETE /api/codex-auth/accounts` | Codex account를 나열/갱신, 선택적으로 가져오기, 또는 삭제합니다. 성공한 POST/DELETE는 `catalogRefreshPending`를 포함합니다. | 400 잘못된 입력; 수동 가져오기를 비활성화할 수 있음 |
| `GET, POST, DELETE /api/codex-auth/accounts` | Codex account를 나열/갱신, 선택적으로 가져오기, 또는 삭제합니다. 성공한 POST/DELETE는 `catalogRefreshPending`를 포함하며 DELETE는 `accountCleanupPending: true`도 포함할 수 있습니다. | 400 잘못된 입력; 404 알 수 없는 account; 409 cleanup-only retry가 account absence를 확인하지 못함; 500 `codex_account_delete_rollback_failed`는 재시도 전에 재시작해야 함; 수동 가져오기를 비활성화할 수 있음 |
| `PUT /api/codex-auth/accounts/alias` | 계정 alias를 설정하거나 지웁니다 | 400 잘못된 account/alias |
| `PUT /api/codex-auth/accounts/pause` | 계정 하나를 일시 중지하거나 재개합니다 | 400 잘못된 account/state; 404 누락된 account |
| `PUT /api/codex-auth/accounts/pause-exhausted` | quota가 소진된 account를 일시 중지합니다 | mutation-lock 실패는 503이 됩니다 |
Expand Down Expand Up @@ -235,6 +235,13 @@ Authorization: Bearer <admin-token>
mutation을 되돌리지 않고 내부 provider/account/path/credential 세부 정보도 반환하지 않습니다. 삭제된
account의 selector binding은 남아 있어 계정이 없을 때 exact route가 fail closed하고 같은 id를 다시 추가하면 같은 selector가 복원됩니다.

config 삭제가 커밋된 뒤 로컬 credential cleanup이 완료되지 못해도 DELETE는 live ownership을
무효화하고 catalog convergence를 요청한 다음 `accountCleanupPending: true`가 포함된 성공 응답을 반환합니다.
같은 DELETE를 반복하면 account row가 이미 없어도 cleanup을 다시 시도합니다. recovery client는 `cleanupOnly=1`을
추가합니다. 이 형식은 persisted account absence를 확인하지 못하면 409로 거부하여 stale retry가 다시 추가된 account를
삭제하지 못하게 합니다. dashboard는 불투명한 account id를 노출하지 않고 이 안전한 재시도 action을 유지하며
CLI는 storage 세부 정보를 노출하지 않는 고정된 `--cleanup-only` 안내를 표시합니다.

## 클라이언트 선택

일반적인 관리 작업에는 [Web Dashboard](/guides/web-dashboard/)가 가장 안전한 안내형 워크플로를 제공합니다. 헤드리스 호스트와 자동화에는 대응하는 `ocx` 명령을 사용하십시오. 이 명령들은 동일한 실시간 API를 호출하며, 프록시에 접근할 수 없거나 작업이 실패하면 0이 아닌 결과를 반환합니다. 직접 HTTP는 위의 정확한 엔드포인트 계약이 필요한 통합에 가장 유용합니다.
Loading
Loading