fix(codex): expose HAPI threads to Codex Desktop (#1022)

* test(codex): reproduce desktop thread classification gap

* fix(codex): classify HAPI threads as user sessions

* test(codex): cover thread source creation paths
This commit is contained in:
SSU-WEI HUANG
2026-07-16 12:35:04 +08:00
committed by GitHub
parent 520c3f511a
commit 6f5ecde2c4
3 changed files with 26 additions and 5 deletions
+9 -2
View File
@@ -98,6 +98,7 @@ const TRUSTED_ACCESS_FOR_CYBER_URL = 'https://chatgpt.com/cyber';
const CYBER_POLICY_TRUSTED_ACCESS_URL = 'https://openai.com/form/enterprise-trusted-access-for-cyber/';
const CODEX_GOALS_UNSUPPORTED_MESSAGE = 'Codex goals are not supported by this Codex runtime. Upgrade Codex or enable features.goals.';
const MAX_CODEX_GOAL_OBJECTIVE_CHARS = 4_000;
const HAPI_TOP_LEVEL_THREAD_SOURCE = 'user';
type GoalForwardSignature = {
objective: string | null;
@@ -3338,7 +3339,10 @@ class CodexRemoteLauncher extends RemoteLauncherBase {
mcpServers,
cliOverrides: session.codexCliOverrides
});
const threadResponse = await appServerClient.startThread(threadParams, {
const threadResponse = await appServerClient.startThread({
...threadParams,
threadSource: HAPI_TOP_LEVEL_THREAD_SOURCE
}, {
signal: this.abortController.signal
});
const threadRecord = asRecord(threadResponse);
@@ -3597,7 +3601,10 @@ class CodexRemoteLauncher extends RemoteLauncherBase {
}
if (!threadId) {
const threadResponse = await appServerClient.startThread(threadParams, {
const threadResponse = await appServerClient.startThread({
...threadParams,
threadSource: HAPI_TOP_LEVEL_THREAD_SOURCE
}, {
signal: this.abortController.signal
});
const threadRecord = asRecord(threadResponse);