Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d35592b
merge dev into main for the v2.32.1 release
lidge-jun Aug 25, 2026
71c57ea
release: v2.32.1
lidge-jun Aug 25, 2026
d560ac6
merge dev into main for the v2.33.0 release
lidge-jun Aug 25, 2026
08ada6f
Merge pull request #2553 from lidge-jun/codex/promote-main-2330
lidge-jun Aug 25, 2026
ec51e42
release: v2.33.0
lidge-jun Aug 25, 2026
e25b653
merge dev into main for the v2.34.0 release
lidge-jun Aug 27, 2026
80fff9a
Merge pull request #2760 from lidge-jun/codex/promote-main-2340
lidge-jun Aug 27, 2026
fc4de77
Merge pull request #2826 from lidge-jun/codex/promote-main-2350
lidge-jun Aug 28, 2026
c7d8407
Merge pull request #3002 from lidge-jun/codex/promote-main-2360
lidge-jun Aug 30, 2026
54e2274
Merge pull request #3037 from lidge-jun/codex/promote-main-2370
lidge-jun Aug 31, 2026
2c4dca1
merge dev into the promotion branch for v2.38.0
lidge-jun Aug 31, 2026
a34e8b7
merge dev into the promotion branch for v2.38.0 (picks up the ReDoS fix)
lidge-jun Aug 31, 2026
ebb4d55
Merge pull request #3073 from lidge-jun/codex/promote-main-2380
lidge-jun Aug 31, 2026
682112e
Merge remote-tracking branch 'origin/dev' into codex/promote-main-2390
lidge-jun Sep 1, 2026
af6113a
merge dev into main for the v2.39.0 release
lidge-jun Sep 1, 2026
847f4f1
merge dev into main for the v2.40.0 release
Sep 2, 2026
ac78647
Merge pull request #3261 from lidge-jun/codex/promote-main-2400
lidge-jun Sep 2, 2026
aaa9eaf
fix(release): pass the bump job's permissions through the reusable-wo…
lidge-jun Sep 2, 2026
35ff3a4
Merge pull request #3263 from lidge-jun/codex/promote-main-2400-relfix
lidge-jun Sep 2, 2026
1ea3f47
fix(client): clear disconnected hub token on recycle
luvs01 Sep 3, 2026
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
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ jobs:
bump-dev-version:
needs: publish
if: ${{ inputs.dry-run != true }}
# A reusable-workflow CALL cannot grant the callee more than the calling job holds,
# and GitHub refuses the whole run at startup when the called workflow's own job
# declares permissions the caller did not pass down ("startup_failure", runs
# 33615174183 / 33615177849 — the first dispatches since #3129 wired this call).
# The callee's job declares exactly these two; nothing else in this file gains them.
permissions:
contents: write
pull-requests: write
uses: ./.github/workflows/dev-version-bump.yml
with:
released-version: v${{ inputs.version }}
Expand Down
4 changes: 2 additions & 2 deletions src/client/machine-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface MachineStatusV1 {
export interface MachineApiDeps {
sync: typeof syncConnectedClient;
disconnect: typeof disconnectClient;
scheduleStandaloneRecycle: () => void;
scheduleStandaloneRecycle: (disconnectedTokenFingerprint: string) => void;
hubReachability?: () => HubReachability;
setHubReachability?: (value: HubReachability) => void;
}
Expand Down Expand Up @@ -129,7 +129,7 @@ export async function handleMachineApi(
}
try {
const result = await deps.disconnect(input.keepCatalog === undefined ? {} : { keepCatalog: input.keepCatalog });
deps.scheduleStandaloneRecycle();
deps.scheduleStandaloneRecycle(state.tokenFingerprint);
return Response.json({ success: true, ...result }, { status: 202 });
} catch (error) {
return Response.json({ success: false, error: error instanceof Error ? error.message : "disconnect failed" }, { status: 409 });
Expand Down
4 changes: 2 additions & 2 deletions src/client/machine-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export function startMachineListener(
const machineApiDeps: MachineApiDeps = {
sync: deps.machineApi?.sync ?? syncConnectedClient,
disconnect: deps.machineApi?.disconnect ?? disconnectClient,
scheduleStandaloneRecycle: deps.machineApi?.scheduleStandaloneRecycle ?? (() => {
void import("./runtime").then(module => module.scheduleStandaloneRecycle());
scheduleStandaloneRecycle: deps.machineApi?.scheduleStandaloneRecycle ?? (tokenFingerprint => {
void import("./runtime").then(module => module.scheduleStandaloneRecycle(tokenFingerprint));
}),
hubReachability: deps.machineApi?.hubReachability ?? (() => hubReachability),
setHubReachability: deps.machineApi?.setHubReachability ?? (value => { hubReachability = value; }),
Expand Down
18 changes: 16 additions & 2 deletions src/client/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { loadConfig } from "../config";
import { removePid, removeRuntimePort, writePid, writeRuntimePort } from "../config/process-state";
import { installCrashGuards } from "../lib/crash-guard";
import { selfLaunchArgv } from "../lib/self-launch-argv";
import { serviceApiTokenFingerprint } from "../lib/service-secrets";
import { findAvailablePort } from "../server/ports";
import { startMachineListener } from "./machine-listener";
import { readClientConnectionState } from "./state";
Expand All @@ -17,7 +18,20 @@ function cleanup(): void {
removeRuntimePort(process.pid);
}

export function scheduleStandaloneRecycle(): void {
export function standaloneRecycleEnv(
env: NodeJS.ProcessEnv,
disconnectedTokenFingerprint: string,
): NodeJS.ProcessEnv {
const childEnv = { ...env };
const admissionToken = childEnv.OPENCODEX_API_AUTH_TOKEN?.trim();
if (admissionToken && serviceApiTokenFingerprint(admissionToken) === disconnectedTokenFingerprint) {
delete childEnv.OPENCODEX_API_AUTH_TOKEN;
delete childEnv.OCX_API_TOKEN_FILE;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve an independent token-file credential

If OPENCODEX_API_AUTH_TOKEN contains the disconnected hub token while OCX_API_TOKEN_FILE points to an independently configured operator credential, this deletes both variables solely because the environment token matches. The replacement therefore cannot let loadServiceTokenFromFile restore the operator credential and starts with no intended admission token. Check the referenced file's token fingerprint or only remove OCX_API_TOKEN_FILE when it identifies the disconnected service-token source.

AGENTS.md reference: src/AGENTS.md:L10-L10

Useful? React with 👍 / 👎.

}
return childEnv;
}

export function scheduleStandaloneRecycle(disconnectedTokenFingerprint: string): void {
if (recycleScheduled) return;
recycleScheduled = true;
const timer = setTimeout(() => {
Expand Down Expand Up @@ -46,7 +60,7 @@ export function scheduleStandaloneRecycle(): void {
detached: true,
stdio: "ignore",
windowsHide: true,
env: { ...process.env },
env: standaloneRecycleEnv(process.env, disconnectedTokenFingerprint),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Sanitize the Task Scheduler restart environment

When the client runs under the Windows Task Scheduler service, this filtered environment is never used because OCX_SERVICE=1 exits through the supervised branch first. In buildWindowsServiceScript (src/service.ts:1727-1758), OPENCODEX_API_AUTH_TOKEN is loaded once before :loop; after disconnect removes the token file and exits with code 1, the wrapper loops without clearing that variable and starts the standalone proxy with the disconnected hub token still active. Reload or clear the token within the wrapper loop, or otherwise communicate the sanitized environment to supervised restarts.

AGENTS.md reference: AGENTS.md:L329-L335

Useful? React with 👍 / 👎.

});
child.unref();
}
Expand Down
4 changes: 3 additions & 1 deletion tests/client-machine-listener.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ describe("client machine listener", () => {
disconnected = true;
return { restored: true, tokenRemoved: true, catalogRemoved: true, apiKeyId: "client-key-a" };
},
scheduleStandaloneRecycle: () => { recycled = disconnected; },
scheduleStandaloneRecycle: tokenFingerprint => {
recycled = disconnected && tokenFingerprint === connection().tokenFingerprint;
},
},
});
servers.push(server);
Expand Down
29 changes: 29 additions & 0 deletions tests/client-runtime.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { describe, expect, test } from "bun:test";
import { serviceApiTokenFingerprint } from "../src/lib/service-secrets";
import { standaloneRecycleEnv } from "../src/client/runtime";

describe("standalone recycle environment", () => {
test("removes a disconnected hub token and its token-file source", () => {
const hubToken = "hub-issued-token";
const source = {
OPENCODEX_API_AUTH_TOKEN: hubToken,
OCX_API_TOKEN_FILE: "/tmp/hub-service-token",
PATH: "/usr/bin",
};

expect(standaloneRecycleEnv(source, serviceApiTokenFingerprint(hubToken))).toEqual({
PATH: "/usr/bin",
});
expect(source.OPENCODEX_API_AUTH_TOKEN).toBe(hubToken);
});

test("preserves an independently configured operator credential", () => {
const operatorToken = "operator-token";
const source = {
OPENCODEX_API_AUTH_TOKEN: operatorToken,
OCX_API_TOKEN_FILE: "/tmp/operator-token",
};

expect(standaloneRecycleEnv(source, serviceApiTokenFingerprint("disconnected-hub-token"))).toEqual(source);
});
});
Loading