@shumkov/orchestra 0.12.1 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ # Provider-specific Codex authentication correction
2
+
3
+ ## Problem and source cause
4
+
5
+ Base Orchestra 0.12.1 (`8457bd6`) and Polygram 0.46.1 (`06ba700`) retain the reviewed Codex 0.167.2 runtime and current Claude changes. Polygram's proxy renderer sets `requires_openai_auth = true`; Orchestra preflight/receipt and Polygram catalog then require a ChatGPT account even when inference uses CLIProxy. This blocks the intended VPS proxy deployment unless unrelated native credentials are provisioned. The user explicitly corrected that requirement: CLIProxy owns upstream auth; no Mac auth transfer or native login.
6
+
7
+ Pinned official source `openai/codex` tag `rust-v0.167.2` establishes:
8
+
9
+ - `model-provider/src/provider.rs::account_state` returns `account: null, requiresOpenaiAuth: false` for the external provider, independent of native account presence.
10
+ - `model-provider/src/auth.rs::resolve_provider_auth` selects the configured provider bearer before native auth; `bearer_auth_for_provider` accepts the existing private bearer mechanism.
11
+ - `model-provider/src/models_endpoint.rs::supports_api_key_models` and `models-manager/src/manager.rs::should_refresh_models` leave this custom provider on bundled model metadata. `model/list` is runtime capability/catalog evidence, not external credentials or entitlement validation.
12
+
13
+ Current official guidance: https://learn.chatgpt.com/docs/config-file/config-reference and https://learn.chatgpt.com/docs/app-server; pinned source is authoritative for the exact runtime. The existing CLIProxy v8.0.4 route authenticates its own client bearer and owns upstream credentials; no native client token is necessary.
14
+
15
+ ## Smallest correction
16
+
17
+ 1. Polygram renders only its already supported named, loopback Responses CLIProxy provider with `requires_openai_auth = false`, retaining private key-file checks, exact configuration hashing, deployment fingerprint fencing and no fallback.
18
+ 2. Orchestra derives auth expectations from the already attested `expectedConfig.modelProvider`; add no configuration option, auth framework or provider discovery. Native `openai` requires ChatGPT plus `requiresOpenaiAuth: true`. CLIProxy requires exactly null account plus `requiresOpenaiAuth: false`. Missing/malformed/mismatched fields fail before model discovery. The account/read wire projector must require an own `account` field and accept explicit null, not normalize omission to null. This is a local fail-closed requirement matching the pinned Rust emitter and TypeScript type; generated JSON Schema alone does not require the field.
19
+ 3. Preserve native public receipt and spawn-profile identity. External preflight uses the distinct truthful state `auth: { authenticated: false, accountType: null, requiresOpenaiAuth: false }`: no OpenAI account was authenticated and external bearer validity has not been inferred from config/catalog. The existing attestation identifies `cliproxyapi`; spawn identity uses null account type alongside that exact provider/config identity. Receipt creation validates the appropriate tuple and retains the successful-result WeakSet provenance requirement.
20
+ 4. Polygram's catalog accepts/project-preserves exactly that provider-specific tuple, selected against the expected profile and authenticated branded Orchestra receipt. It never relabels an external provider as ChatGPT or claims a catalog is external entitlement proof. Native missing auth and cross-provider receipt/account mismatches still fail and invalidate cache.
21
+ 5. Amend the prior Polygram minimal spec's CLIProxy paragraph and affected runtime compatibility docs to replace the obsolete native-login requirement. Preserve existing limited/trusted policies, skills/instruction binding, native mode, hooks, launcher and process lifecycle contracts. No production configuration, services, login stores, package pins or release versions change here.
22
+
23
+ Alternatives rejected: provision native ChatGPT credentials (contradicts requested routing and transfers unrelated auth); bypass all account checks (loses provider mismatch fencing); add a generic provider-auth framework or new login mechanism (unnecessary); call model/list an authenticated entitlement check (false for the pinned runtime); add a paid turn to ordinary preflight (unnecessary recurring cost).
24
+
25
+ ## Regression and verification
26
+
27
+ Write focused tests first and observe RED on current source: no-native-account CLIProxy preflight/receipt and consumer catalog, plus owned provider config rendering. Then implement and observe GREEN. Existing native success remains byte-compatible; null/missing/wrong account, wrong boolean, cross-profile auth, forged/cloned receipt, static routing/key drift and cache invalidation paths must reject. Reuse existing tests and fixtures, no general harness.
28
+
29
+ After deterministic gates, use existing exact 0.167.2 binary/helper and a private isolated workspace/home with no auth.json or native credential env. Prove synthetic loopback fixture tool execution/routes and failure-without-native-fallback first. Then run ONE fresh real CLIProxy Astra lane, at most two logical turns, using its existing bearer only, safe synthetic root instruction/skill/memory and fresh-process resume. Never transfer native auth or access real business/memory data. Stop on paid failure/ambiguity; report attempts/completions separately. No repeated native/provider/Claude matrix. Source remains uncommitted for coordinator integration, no publication/deployment. Recommended eventual patches: Orchestra 0.12.2 then Polygram 0.46.2 (subject to fresh registry state).
30
+
31
+ ## Independent design review
32
+
33
+ Two read-only reviews (security/failure modes and feasibility/scope/native compatibility) approved the three-field tuple and unchanged native hashing. Both required the explicit-account wire guard plus raw-response regression; this amendment is included above. No general auth framework, separate public auth field or additional inference in preflight is needed.
34
+
35
+ ## Verification result and release handoff
36
+
37
+ Focused regressions were RED on the unchanged bases (Orchestra four failures; Polygram three failures), then GREEN after the provider-specific correction. Final full unit suites on Node 26.5.0: Orchestra 1,618 passed, zero failed, 19 existing capability N/A skips; Polygram 4,829 passed, zero failed, 16 opt-in skips. The actual pinned Darwin ARM64 runtime/helper completed an empty-auth-home loopback tool/resume/steer/event-delivery fixture. A separate synthetic 401 fixture failed closed without native auth: one logical turn, zero successful completions, six internal HTTP attempts. Two independent source reviews cleared the final auth diff; a probe callback cleanup finding was corrected and re-reviewed.
38
+
39
+ The single authorized real CLIProxy Astra lane used the existing private VPS bearer through an owned SSH forward, no native auth source read/copy, isolated HOME/CODEX_HOME and controlled environment. Two provider turns returned successful terminal results. The first proved actual tools, canonical root instruction consumption, discovered skill-body consumption and unprompted synthetic memory. The second proved fresh-process resume and semantic steering, then failed the additional assertion that its final answer contain a memory nonce edited between turns. Overall probe outcome remains **failed**; no paid retry was made. The old harness counter incremented after that assertion and reported one completion; its source-ordered path proves two successful provider completions, and counting now occurs before semantic assertions. Raw and explicitly corrected reports are preserved separately under `/tmp/codex-proxy-auth-evidence/`.
40
+
41
+ The fixture's root instruction says to read shared memory before answering a calibration request. Shumabit's canonical root AGENTS.md likewise requires explicit matching per-chat memo reads at each Telegram turn. Retained evidence establishes omission of the edited nonce, not whether the model reread the file or reused an old value; the synthetic tool/transcript tree was removed during private cleanup. This patch changes provider auth admission only, not instruction binding or memory loading; no patch-caused memory regression is established. Edited-memory freshness remains unproven and is not relabeled PASS.
42
+
43
+ The temporary real bearer, owned credential-bearing test tree and SSH forward were removed; remote bearer hash was unchanged. Native auth contents were never read, and native auth file metadata remained unchanged. No production configuration, services, installed packages or source commits changed.
44
+
45
+ Recommend ordinary patch releases Orchestra **0.12.2**, then Polygram **0.46.2** consuming that exact release (registry still 0.12.1/0.46.1 at handoff). Latest bases retain Claude SDK 0.3.322 and CLI default 2.1.322 unchanged. For a later VPS CLI-only activation that must keep running Claude 2.1.283, use the existing `ORCHESTRA_CLAUDE_BIN=/home/shumabit/.local/share/polygram/claude-bin/2.1.283` override before daemon startup, retaining the existing CLI routing and exact proxy/session launcher. `ensureVendoredClaudeBin` returns this executable override before vendoring/GC/installation, so default .322 selection cannot replace the active .283 path. The actual VPS file still reported 2.1.283 during read-only verification. Verify the selected executable/version, not the startup log's default pin label. Do not enable SDK routing under this path: the new packages contain SDK .322, while no new VPS SDK admission/soak is proved. If preserving the *installed SDK package* at .283 is also mandatory, these latest-base packages cannot meet that additional condition unchanged; an ordinary maintenance backport is needed instead. No such pin changes or deployment are made here.
@@ -96,7 +96,10 @@ stop requiring a reviewed spec amendment, not an extra accepted hash or stripped
96
96
  unknown fields. Native memories remain disabled; shell inherits none, login false,
97
97
  trusted actual service HOME/explicit PATH; limited mode retains its existing synthetic
98
98
  command HOME and controlled PATH. CLIProxy remains optional, loopback Responses, private
99
- bearer, requires_openai_auth=true, supports_websockets=true, no native fallback.
99
+ bearer, requires_openai_auth=false, supports_websockets=true, no native fallback.
100
+ The provider-specific auth correction in CODEX_PROXY_AUTH_FIX_SPEC.md supersedes
101
+ the initial requirement to keep native ChatGPT auth for CLIProxy; native OpenAI
102
+ mode still requires its ChatGPT account.
100
103
 
101
104
  ## Verification and failure handling
102
105
 
@@ -117,9 +120,9 @@ rollout can resume under candidate, retaining an untouched old copy.
117
120
  At least one candidate fixture must traverse production preflight -> spawn receipt
118
121
  -> factory/CodexProcess -> acknowledged on-disk checkpoint sink, with authoritative
119
122
  checkpoint readback; a no-op client sink cannot establish this integration layer.
120
- Credential-free fixture-only providers may set requires_openai_auth=false; that
121
- exception never clears production native ChatGPT-auth admission, which is proved
122
- separately using the exact native/CLIProxy policy.
123
+ Credential-free fixtures and explicit bearer-authenticated CLIProxy set
124
+ requires_openai_auth=false; native OpenAI retains ChatGPT-auth admission.
125
+ Model catalogs alone never establish external provider entitlement.
123
126
  3. Hooks: run existing hooks-on/off production-client gate against candidate; raw
124
127
  inventory characterization before exact verifier update, red/green fixture tests,
125
128
  negative metadata tests, trusted inventory and content-free event dropping.
@@ -904,3 +904,19 @@ configuration where `effective.hooks != null`, so the reviewed hook-free
904
904
  validation profile above is unchanged and was not re-run with hooks. A
905
905
  hook-enabled authenticated run against the hosted backend, and the
906
906
  wrapper/absolute-binary-path rejection, remain unproved here.
907
+
908
+ ## Provider-specific auth admission
909
+
910
+ Native OpenAI preflight still requires a ChatGPT account and `requiresOpenaiAuth: true`.
911
+ Explicit CLIProxy instead uses its private provider bearer with
912
+ `requires_openai_auth = false` and requires a null account plus false auth requirement.
913
+ Its receipt state is `auth: { authenticated: false, accountType: null, requiresOpenaiAuth: false }`;
914
+ this does not claim external bearer validity or provider entitlement from `model/list`.
915
+ The existing exact provider/config attestation and successful-result receipt provenance
916
+ bind that state to CLIProxy and reject native/proxy mismatches. Native receipt shape
917
+ and fingerprint inputs remain unchanged. Missing raw account fields fail closed locally
918
+ instead of being projected into a legitimate null account.
919
+
920
+ See [provider auth correction](CODEX_PROXY_AUTH_FIX_SPEC.md). Historical validation
921
+ above that used a native auth clone for CLIProxy remains historical evidence; the
922
+ current external route requires no native login or copied authentication.
@@ -1576,7 +1576,7 @@ function projectRpcResult(method, value, ownedCwd) {
1576
1576
  };
1577
1577
  }
1578
1578
  if (method === 'account/read') {
1579
- if (typeof result.requiresOpenaiAuth !== 'boolean') {
1579
+ if (!Object.hasOwn(result, 'account') || typeof result.requiresOpenaiAuth !== 'boolean') {
1580
1580
  throw new CodexAppServerError(
1581
1581
  'app-server account auth requirement is malformed',
1582
1582
  'CODEX_PROTOCOL_ERROR',
@@ -811,6 +811,15 @@ function receiptInvalid(message) {
811
811
  );
812
812
  }
813
813
 
814
+ function expectedAuthentication(profile) {
815
+ const native = profile.expectedConfig.modelProvider === 'openai';
816
+ return {
817
+ authenticated: native,
818
+ accountType: native ? 'chatgpt' : null,
819
+ requiresOpenaiAuth: native,
820
+ };
821
+ }
822
+
814
823
  function createCodexSpawnProfile(expectedStaticProfile, preflightResult) {
815
824
  const profile = deepFreeze(normalizeExpectedProfile(expectedStaticProfile));
816
825
  let result;
@@ -850,16 +859,17 @@ function createCodexSpawnProfile(expectedStaticProfile, preflightResult) {
850
859
  } catch (error) {
851
860
  throw receiptInvalid(error.message);
852
861
  }
862
+ const expectedAuth = expectedAuthentication(profile);
853
863
  if (
854
- auth.authenticated !== true
855
- || auth.accountType !== 'chatgpt'
856
- || typeof auth.requiresOpenaiAuth !== 'boolean'
864
+ auth.authenticated !== expectedAuth.authenticated
865
+ || auth.accountType !== expectedAuth.accountType
866
+ || auth.requiresOpenaiAuth !== expectedAuth.requiresOpenaiAuth
857
867
  || selected.model !== profile.model
858
868
  || selected.effort !== profile.effort
859
869
  || !Array.isArray(result.models)
860
870
  || !Array.isArray(result.efforts)
861
871
  ) {
862
- throw receiptInvalid('authenticated model selection did not match');
872
+ throw receiptInvalid('provider authentication or model selection did not match');
863
873
  }
864
874
  const selectedModels = result.models.filter(
865
875
  (entry) => entry?.model === profile.model,
@@ -895,7 +905,7 @@ function createCodexSpawnProfile(expectedStaticProfile, preflightResult) {
895
905
  runtimeVersion: profile.cliVersion,
896
906
  schemaVersion: profile.protocolSchemaSha256,
897
907
  attestation: expectedAttestation,
898
- accountType: 'chatgpt',
908
+ accountType: expectedAuth.accountType,
899
909
  });
900
910
  if (result.spawnProfileId !== expectedSpawnProfileId) {
901
911
  throw receiptInvalid('spawn-profile identity did not match');
@@ -996,15 +1006,17 @@ async function runPreflight(profile, client) {
996
1006
  await client.request('account/read', { refreshToken: false }),
997
1007
  'account result',
998
1008
  );
999
- if (account.account?.type !== 'chatgpt') {
1000
- throw new CodexPreflightError(
1001
- 'Codex ChatGPT authentication is unavailable',
1002
- 'CODEX_AUTH_UNAVAILABLE',
1003
- );
1004
- }
1005
- if (typeof account.requiresOpenaiAuth !== 'boolean') {
1009
+ const auth = expectedAuthentication(profile);
1010
+ if (
1011
+ account.requiresOpenaiAuth !== auth.requiresOpenaiAuth
1012
+ || (auth.authenticated
1013
+ ? account.account?.type !== 'chatgpt'
1014
+ : account.account !== null)
1015
+ ) {
1006
1016
  throw new CodexPreflightError(
1007
- 'Codex authentication projection was malformed',
1017
+ auth.authenticated
1018
+ ? 'Codex ChatGPT authentication is unavailable'
1019
+ : 'Codex external-provider account state did not match',
1008
1020
  'CODEX_AUTH_UNAVAILABLE',
1009
1021
  );
1010
1022
  }
@@ -1044,18 +1056,14 @@ async function runPreflight(profile, client) {
1044
1056
  runtimeVersion: profile.cliVersion,
1045
1057
  schemaVersion: profile.protocolSchemaSha256,
1046
1058
  attestation,
1047
- accountType: account.account.type,
1059
+ accountType: auth.accountType,
1048
1060
  });
1049
1061
  return deepFreeze({
1050
1062
  runtime: 'codex',
1051
1063
  runtimeVersion: profile.cliVersion,
1052
1064
  schemaVersion: profile.protocolSchemaSha256,
1053
1065
  spawnProfileId,
1054
- auth: {
1055
- authenticated: true,
1056
- accountType: account.account.type,
1057
- requiresOpenaiAuth: account.requiresOpenaiAuth,
1058
- },
1066
+ auth,
1059
1067
  attestation,
1060
1068
  models,
1061
1069
  efforts: [...selected.supportedReasoningEfforts],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shumkov/orchestra",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "description": "Transport-agnostic session engine for Claude Code and the native Codex app-server: spawn, steer, supervise, observe turns, and recover.",
5
5
  "type": "commonjs",
6
6
  "main": "index.js",