Commit ccc8a92
fix(codex): handle v0.136+ TUI footer and skip MCP tool-call markers … (#274)
* fix(codex): handle v0.136+ TUI footer and skip MCP tool-call markers in extraction
Two bugs in CodexProvider, both surfaced by the e2e suite on codex 0.136+:
1. TUI footer detection — codex 0.136 dropped the "N% left" segment; the
footer is now just "model · path". TUI_FOOTER_PATTERN never matched, so
get_status() couldn't distinguish the suggestion hint ("› Run /review on
my current changes") from a real user message and pinned terminals at
IDLE forever. Pattern extended to anchor on "·\s+[~/]".
2. extract_last_message_from_script() anchored on the first "•" after the
user prompt, which can be a "• Called <mcp_server>.<tool>(...)" tool-call
marker. The lines that follow are tool output, not the model's reply, so
when codex called load_skill before responding the extracted message
leaked the cao-worker-protocols skill body (which mentions
"[CAO Handoff]") into the test output. Now iterates "•" matches and
skips MCP_TOOL_CALL_PATTERN. Also tightened ASSISTANT_PREFIX_PATTERN
from "\s*•" to "[^\S\n]*•" so the match anchors on the bullet line
itself, not a preceding blank line.
Verified end-to-end: 11/12 codex e2e pass (1 xfailed expected), 81/81
unit tests including 3 new regressions for the v0.136 footer and tool-call
marker filtering.
* style: apply black formatting
Run black on codex.py and the unit test file to satisfy the Code
Quality CI check on PR #274.
* fix(codex): tighten MCP tool-call filter and apply it to status detection
Address Copilot review on PR #274 — two related concerns:
1. MCP_TOOL_CALL_PATTERN was too loose: "^[^\S\n]*•\s+Called\s+\S+"
matched any "• Called <word>" so a real model bullet like
"• Called attention to the bug" would be filtered out as a tool call.
Tightened to require the documented "<server>.<tool>(" shape:
"^[^\S\n]*•\s+Called\s+[\w-]+\.[\w-]+\(".
2. get_status()'s COMPLETED check searched ASSISTANT_PREFIX_PATTERN
without filtering tool-call markers. A "• Called <server>.<tool>(...)"
bullet emitted before the model has actually replied could trip
COMPLETED on its own. Factored the per-line tool-call filter into a
_find_assistant_marker() helper and applied it in get_status()
(both COMPLETED detection and assistant_after_last_user gating) and
in extract_last_message_from_script().
Tests:
- test_extract_does_not_filter_called_as_english_word — guards against
over-broad filtering of legitimate model bullets.
- test_get_status_idle_when_only_tool_call_after_user — IDLE when the
only "•" after the user prompt is a tool-call marker.
- test_get_status_completed_when_real_reply_after_tool_call — COMPLETED
when a real "•" reply follows a tool-call marker.
84 unit tests pass.
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>1 parent 946a5b2 commit ccc8a92
3 files changed
Lines changed: 295 additions & 23 deletions
File tree
- src/cli_agent_orchestrator/providers
- test/providers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
55 | 63 | | |
56 | 64 | | |
57 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
35 | 46 | | |
36 | 47 | | |
37 | 48 | | |
| |||
50 | 61 | | |
51 | 62 | | |
52 | 63 | | |
53 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
54 | 68 | | |
55 | 69 | | |
56 | 70 | | |
| |||
104 | 118 | | |
105 | 119 | | |
106 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
107 | 142 | | |
108 | 143 | | |
109 | 144 | | |
| |||
321 | 356 | | |
322 | 357 | | |
323 | 358 | | |
| 359 | + | |
| 360 | + | |
324 | 361 | | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 362 | + | |
331 | 363 | | |
332 | 364 | | |
333 | 365 | | |
| |||
373 | 405 | | |
374 | 406 | | |
375 | 407 | | |
376 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
377 | 412 | | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
| 413 | + | |
383 | 414 | | |
384 | 415 | | |
385 | 416 | | |
| |||
428 | 459 | | |
429 | 460 | | |
430 | 461 | | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
438 | 468 | | |
439 | 469 | | |
440 | 470 | | |
| |||
473 | 503 | | |
474 | 504 | | |
475 | 505 | | |
476 | | - | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
477 | 509 | | |
478 | 510 | | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
479 | 520 | | |
480 | 521 | | |
481 | 522 | | |
| |||
0 commit comments