fix: forward ONECLI_API_KEY to OneCLI SDK for authenticated container config

Ports the v1 fix from PR #1777 (originally 8b5b581 by @johnnyfish).
Cherry-pick did not apply cleanly because v2 reformatted the surrounding
code and split OneCLI usage into two sites — manual port was needed.

v2-specific adaptations:
- Also forward apiKey at the second OneCLI call site in
  src/modules/approvals/onecli-approvals.ts (v2 split the approvals
  module out of container-runner).
- Skipped the companion test-mock commit (38163bc) — it patches
  src/container-runner.test.ts, which no longer exists in v2 (tests
  consolidated into host-core.test.ts).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: johnnyfish <jonathanfishner11@gmail.com>
This commit is contained in:
gavrielc
2026-04-22 15:16:59 +03:00
parent 5371c76c14
commit 3db66c0ced
3 changed files with 12 additions and 5 deletions

View File

@@ -20,7 +20,7 @@
import { OneCLI, type ApprovalRequest, type ManualApprovalHandle } from '@onecli-sh/sdk';
import { pickApprovalDelivery, pickApprover } from './primitive.js';
import { ONECLI_URL } from '../../config.js';
import { ONECLI_API_KEY, ONECLI_URL } from '../../config.js';
import { getAgentGroup } from '../../db/agent-groups.js';
import {
createPendingApproval,
@@ -36,7 +36,7 @@ export const ONECLI_ACTION = 'onecli_credential';
type Decision = 'approve' | 'deny';
const onecli = new OneCLI({ url: ONECLI_URL });
const onecli = new OneCLI({ url: ONECLI_URL, apiKey: ONECLI_API_KEY });
interface PendingState {
resolve: (decision: Decision) => void;