fix(web): show Codex round usage metadata (#1685)

* fix(web): show Codex round usage metadata

* fix(web): skip imported Codex round duration
This commit is contained in:
Ananovo
2026-09-09 09:32:43 +08:00
committed by GitHub
parent ceb9314350
commit 2b402d24d9
13 changed files with 210 additions and 4 deletions
+3
View File
@@ -424,6 +424,7 @@ describe('codexLocalLauncher', () => {
expect(getModelReasoningEffort()).toBeNull();
expect(agentMessages).toContainEqual(expect.objectContaining({
type: 'token_count',
flavor: 'codex',
model: 'gpt-5.4',
usageSchema: 'hapi.usage.v1',
inputTokenSemantics: 'includes-cache'
@@ -755,8 +756,10 @@ describe('codexLocalLauncher', () => {
usageSchema: 'hapi.usage.v1',
inputTokenSemantics: 'includes-cache'
});
expect(tokenMessages[0]).not.toHaveProperty('flavor');
expect(tokenMessages[0]).not.toHaveProperty('thread_id');
expect(tokenMessages[1]).toMatchObject({
flavor: 'codex',
threadId: 'codex-thread-import',
thread_id: 'codex-thread-import',
hapiUsageScope: 'managed',
+2 -1
View File
@@ -221,12 +221,13 @@ export async function codexLocalLauncher(session: CodexSession): Promise<'switch
: primarySessionId
? {
...message,
flavor: 'codex',
model: transcriptModel,
threadId: primarySessionId,
thread_id: primarySessionId,
hapiUsageScope: 'managed'
}
: { ...message, model: transcriptModel };
: { ...message, flavor: 'codex', model: transcriptModel };
session.sendAgentMessage(scopedMessage);
}
}
@@ -3234,6 +3234,7 @@ describe('codexRemoteLauncher', () => {
expect(codexMessages).toContainEqual(expect.objectContaining({
type: 'token_count',
flavor: 'codex',
thread_id: 'thread-1',
usageSchema: 'hapi.usage.v1',
inputTokenSemantics: 'includes-cache',
+1
View File
@@ -3253,6 +3253,7 @@ class CodexRemoteLauncher extends RemoteLauncherBase {
const threadId = eventThreadId ?? this.currentThreadId;
session.sendAgentMessage({
...addCodexEventScope(msg, 'parent', threadId),
flavor: 'codex',
model: asString(msg.model) ?? usageModel,
id: randomUUID()
});