MCPcopy Create free account
hub / github.com/github/gh-aw / extractCodexModel

Function extractCodexModel

actions/setup/js/parse_codex_log.cjs:282–295  ·  view source on GitHub ↗

* Extract the model name from Codex log header lines. * Codex logs include a line like "model: o4-mini" near the top. * @param {string} logContent - The raw log content * @returns {string|null} The model name, or null if not found

(logContent)

Source from the content-addressed store, hash-verified

280 * @returns {string|null} The model name, or null if not found
281 */
282function extractCodexModel(logContent) {
283 const match = logContent.match(/^model:\s*(.+)$/m);
284 if (match) {
285 return match[1].trim();
286 }
287 // Fallback for the experimental JSONL format, which has no "model:" header line.
288 // The codex harness logs the resolved spawn command, e.g.
289 // [codex-harness] ... spawning: codex exec --model gpt-5.4 -c ...
290 const spawnMatch = logContent.match(/spawning:\s*codex\s+exec\s+--model\s+(\S+)/);
291 if (spawnMatch) {
292 return spawnMatch[1].trim();
293 }
294 return null;
295}
296
297/**
298 * Detects whether the log is in the Codex experimental JSONL event format.

Callers 3

parseCodexJsonlFunction · 0.85
parseCodexLogFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected