Commit 4d5de9c
committed
codex: retry without --profile when the first attempt fails fast
ucode's codex launch always ran `codex --profile ucode <args>`, but codex only
accepts the global `--profile` on runtime subcommands. Server-family
subcommands (app-server, mcp-server, exec-server, remote-control) reject it up
front:
Error: --profile only applies to runtime commands and `codex mcp`: ...
so e.g. `ucode codex app-server` was functionally broken.
Run codex with `--profile` first; if that attempt exits nonzero *and* does so
fast (< 3s), relaunch without `--profile`. No stderr capture, no temp file, no
subcommand allow-list to maintain. The signal is timing, not the error text:
codex's `--profile` rejection is a CLI parse-time error (~0.15s, before it
touches auth/gateway/network), whereas a session that actually starts can only
fail after a network round-trip (seconds) — there is no overlap, and the exit
code alone can't tell them apart (both are 1).
The fast-failure gate is what keeps this strictly better than the status quo:
without it, a genuinely-failing `codex exec` would be silently re-run without
`--profile` — i.e. on the user's own OpenAI login, since ucode writes a
*named-profile* file and no `--profile` means no ucode routing. stdio is
inherited (no capture), so Ctrl-C reaches codex directly and quitting an
interactive session propagates a KeyboardInterrupt past the retry check rather
than tripping it.
Co-authored-by: Isaac1 parent a0a0d1c commit 4d5de9c
2 files changed
Lines changed: 107 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
391 | 394 | | |
392 | 395 | | |
393 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
394 | 408 | | |
395 | 409 | | |
396 | 410 | | |
397 | 411 | | |
398 | 412 | | |
399 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
400 | 439 | | |
401 | 440 | | |
402 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
416 | 418 | | |
417 | 419 | | |
418 | 420 | | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
426 | 446 | | |
| 447 | + | |
427 | 448 | | |
428 | 449 | | |
429 | 450 | | |
430 | | - | |
431 | | - | |
432 | | - | |
| 451 | + | |
433 | 452 | | |
434 | | - | |
435 | | - | |
436 | | - | |
| 453 | + | |
437 | 454 | | |
438 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
0 commit comments