Skip to content

Preserve image drafts and improve picker feedback - #394

Merged
saioai merged 14 commits into
mainfrom
codex/image-workflow-drafts
Oct 9, 2026
Merged

saioai merged 14 commits into
mainfrom
codex/image-workflow-drafts

Conversation

@saioai

@saioai saioai commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

The image picker discarded edits after exiting and closed when an image request failed. This preserves the draft and lets you edit before retrying.

What changes

  • Restore the prompt, committed settings, and save folder when the picker reopens.
  • Save drafts before requests and on changed controlled exits. Reopening never submits a request.
  • Keep failed requests editable, with concise authentication and recovery guidance.
  • Separate error guidance from the reopened picker with one blank line.
  • Show the spinner, quoted prompt, elapsed time, and actual saving status on the picker’s stdout interface.
  • Keep prompts out of diagnostic stderr. Direct commands use generic loading labels.
  • Keep picker feedback visible when stderr is redirected.
  • Align menu choices, stabilize arrow navigation, and separate completed batch previews.
  • Preserve Models loading, cancellation, and complete record printing after its merge into main.

Prompts now persist in local picker state. Explicit flags, piped input, and structured output retain their request and output-mode behavior.
Forced termination or power loss can discard unsaved edits. Concurrent edited sessions retain the last successful complete draft.
Generation feedback adds no API calls.

Commands

No new commands or flags.

openai images generate                       # open or restore the draft
openai help setup                            # read the offline setup guide
openai images generate --prompt 'a red kite'  # use explicit command inputs

Exit with Ctrl+C and reopen the picker to continue editing. Generation still requires a deliberate Enter.

Code

pkg/custom owns draft persistence, request recovery, loading feedback, picker layout, and preview spacing.
The existing atomic state writer stores a versioned prompt/settings record. Legacy settings remain readable.
Recording recipes reuse the shared lifecycle in scripts/demos.
The Models caller passes an empty prompt and terminal dimensions to the shared loading helper.
It retains only the stop callback; Models never advances image-saving stages.

No new package, dependency, generated command, or startup change is included.
The terminal-image test checks its existing final-newline contract; production renderer code is unchanged.

Tested

Initial macOS checks at 37f0ce01 passed 454 focused race test/subtest events and 94 process dispatch events.
One font producer contract test passed.
Four shell/helper tests skipped; fish and PowerShell were unavailable.
Six bash/zsh setup-copy checks passed, including executable paths containing spaces.
Eight native terminal scenarios and 134 navigation replay assertions passed.
They cover retries, cancellation, partial saves, preview spacing, restored drafts, queued input, and the installed launcher.
Dispatch checks also cover explicit formats, closed output, multipart scalars, and large synthetic image responses.

The direct-input correction at 07551104 passed eight focused race events and six public input checks.
File, JSON/YAML stdin, literal flag, and multipart prompts retain their request values; uploaded bytes remain unchanged.

The final loading correction at 0024d0b passed 59 focused race events and seven redirected-output/input events.
Separate-stream checks reproduced both earlier issues, then passed five picker and direct-command cases.
These checks cover redirected diagnostics, current prompts, terminal width, unchanged requests, saving order, cleanup, and cancellation.
The shared process helper also passed its existing combined-stream retry check at 7b336e1.
The spacing update passed its writer checks. Main alignment at fb00753 passed 18 focused compatibility events.

The integration at 2da2da3 preserves the original Images patch and inherits Go 1.26.9 from merged main.
Seven focused race tests and seven subcases passed, plus seven image public-mode test events.
Six Models terminal cases verify Ctrl+C 130, q/Escape/p 0, complete records, clean redirects, and terminal cleanup.
Three image terminal controls also passed. The unchanged vulnerability checker passed all nine shipped targets.
Main’s SDK alignment at bc8203c passed 38 fresh race/public test events, including image stream completion, failure, and cancellation.
Module verification and all nine vulnerability targets passed again.
The nine native controls remain attributed to 2da2da3; independent review confirmed their paths are unchanged.
Independent source and capture review passed. CI and fresh code/security reviews passed at bc8203c.
No live API requests or paid image generation were used.
Native Windows/Linux picker behavior and terminal graphics appearance remain unverified.

Demo

Real CLI binaries on macOS, recorded as a terminal replay with synthetic drafts and zero API requests.
Before is main d32b3ae; after was recorded at runtime 37f0ce01.
The later loading corrections and Models integration do not change this draft-reopen scene.
Both scenes edit the prompt and quality, exit, then reopen the picker.

Image drafts before and after

Before:

Before: unsent edits are lost after reopening

After:

After: the prompt and Low quality return

Recording recipe · Process checks

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Castiron custom code

Evaluated main: e32158e57f05eae260ebb7a0bd0cacc6b2961ce1.

✅ No new custom-code files detected.

2 mixed files remain; 0 existing customizations changed.

Compared e32158e57f05 → bc8203c2eb76. Generated baselines verified.

2 existing customizations unchanged
  • pkg/cmd/adminorganizationcertificate.go
  • pkg/cmd/audiovoice.go

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 37867449820 --repo openai/openai-cli \
  --name castiron-custom-code-37867449820-1 --dir /tmp/castiron-custom-code-37867449820-1
git apply --stat /tmp/castiron-custom-code-37867449820-1/custom-code.patch
cat /tmp/castiron-custom-code-37867449820-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin e32158e57f05eae260ebb7a0bd0cacc6b2961ce1 bc8203c2eb767b3cc764fcd8dd9b553f8b301573
python3 scripts/castiron/custom_code_report.py report \
  --base e32158e57f05eae260ebb7a0bd0cacc6b2961ce1 \
  --head bc8203c2eb767b3cc764fcd8dd9b553f8b301573 --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-bc8203c2eb76
cat /tmp/castiron-custom-code-bc8203c2eb76/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@saioai

saioai commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

Please review commit d7cb5cbcd8e55556703959cdbeddcba666300c36 against this PR's current base. Check public-command behavior, preserved input/output contracts, errors, and cancellation. Distinguish code defects from the documented validation limits.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T00:50:54.295244Z bc8203c New commits
🔒 Security Review ✅ Completed 2026-10-09T00:51:32.581518Z bc8203c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7cb5cbcd8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkg/custom/save_generated_images.go Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: d7cb5cbcd8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@saioai

saioai commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

Please review commit 075511040c52b64c79fbd21668f10b4eec8f51ec against this PR's unchanged base.

This addresses discussion_r4221652116. Loading feedback receives only the current prompt already displayed in the interactive picker. Direct request bodies no longer supply loading text.

Independent native checks covered file, JSON/YAML stdin, literal flags, multipart edit, and redirected stderr. Request values, uploaded bytes, and exit statuses remain unchanged. Picker retry and cancellation preserve the current quoted prompt, spinner, elapsed time, saving state, and cleanup.

Please check the prompt-source boundary, per-request context isolation, and preserved request/error/cancellation behavior.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 075511040c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 075511040c

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@saioai
saioai marked this pull request as ready for review October 8, 2026 21:25
@saioai
saioai requested a review from a team as a code owner October 8, 2026 21:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 43c71b513c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkg/custom/image_picker_generate.go
Comment thread scripts/demos/image_picker_loading_streams_check.py Fixed
Comment thread scripts/demos/image_picker_loading_streams_check.py Fixed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb00753ab9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkg/custom/image_loading_feedback.go Outdated

@markstuart-oai markstuart-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 0024d0bd25beedfde1ae8762488e2610dfd3bd3c. No blocking findings.

The versioned draft uses the existing atomic state writer. Controlled exits save edited drafts; reopening does not submit a request, and explicit flags or redirected input retain the direct-command path. Recoverable request errors keep the draft editable, while cancellation and save/preview failures exit without another generation. Picker prompt feedback uses stdout; direct commands keep generic diagnostic labels. Saving status follows the save operation, and feedback stops before results and previews are written.

Validation: source review of the implementation, tests, and check scripts, including the previously reported prompt-output and redirected-stderr issues. No repository workloads ran here. Current-head hosted tests, build, lint, help checks, CodeQL, and Castiron checks passed; conditional jobs were skipped. The detailed macOS scenarios and recording results remain author-reported. Native Linux/Windows picker behavior and graphical rendering remain unverified.

@saioai
saioai added this pull request to the merge queue Oct 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 8, 2026
@saioai
saioai added this pull request to the merge queue Oct 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 8, 2026
@saioai
saioai added this pull request to the merge queue Oct 9, 2026
Merged via the queue into main with commit 1dc9d3d Oct 9, 2026
27 checks passed
@saioai
saioai deleted the codex/image-workflow-drafts branch October 9, 2026 01:08
Tmwakalasya pushed a commit to Tmwakalasya/openai-cli that referenced this pull request Oct 9, 2026
…#391)

Large model lists currently fill the terminal with metadata.
This shows each model's exact ID and owner, with clear navigation for
large results.
Slow interactive requests show loading feedback instead of an
unexplained blank screen.

### What changes

- Show sorted ID and OWNER columns in automatic interactive output.
- Preserve both complete values in labeled output when the terminal is
narrow.
- Keep all accessible models, including fine-tuned IDs; unavailable
owners show `(unknown)`.
- Finish short results directly and show empty results clearly.
- Use the existing viewer for long lists: Space advances, b goes back,
and q exits.
- Explain that p prints all selected complete records, including
metadata.
- Add Models-only `--filter` and `--sort-by` controls.
- Show delayed loading feedback through slow response headers, body
reads, and retries.
- Stop feedback before rendering, preserve Ctrl+C status 130, and
restore the terminal.
- Preserve explicit formats, field extraction, pipes, and legacy limit
ordering without selection controls.

### Commands

`models list` remains the same command.
Only `--filter` and `--sort-by` are new flags.

```sh
openai models list                          # IDs and owners in an interactive terminal
openai models list --format json            # complete records
openai models list --transform id --raw-output  # IDs for a pipeline

# Match one exact ID.
openai models list --filter 'id = "demo-text-alpha"'

# Filter, sort descending, then keep three results.
openai models list --filter 'id~^demo-text-' --sort-by '~id' --max-items 3
```

Filters support exact `id=VALUE` and RE2 `id~REGEX` matching.
Matches are case-sensitive unless the regex changes that behavior.
Boolean expressions and operand lists are unsupported.
Quote the whole expression for your shell.
Operand quotes and backslash escapes are decoded before matching.

Selection sorts before `--max-items`; omitted selection retains
response-order limiting before terminal display sorting.
The limit defaults to unlimited; `-1` remains supported and `0` returns
no items.
Selection rejects `--format raw` before HTTP.
Raw output without selection retains the full response envelope.

### Code

This PR targets main `c65e03e`, after Navigation openai#389 and Tables openai#390
merged.
It preserves the reviewed Navigation completion and terminal-boundary
corrections.
Models uses the SDK's single-response pager; navigating makes no
additional API request.

`pkg/custom` owns command options, loading feedback, presentation, and
the Models viewer adapter.
`pkg/transformers` selects complete records and projects exact ID/owner
pairs.
Shared readable tables and Bubble Tea/Bubbles handle layout and
navigation.
The existing delayed-feedback helper supplies loading feedback.
Two presentation hooks stop and join its worker before results write.

Generated sources, module dependencies, entrypoint wiring, and payload
limits remain unchanged.
The one-line `.go-version` pin selects Go 1.26.9 while the Actions
version index catches up.
This security patch passes the existing vulnerability scan. Future Go
patches require updating the pin.
Universal Output composition still needs its shared policy for the
optional Details hint.
The local follow-up patch remains separate; this branch does not add
universal `--quiet`.

Images openai#394 changes the shared loading-helper signature.
Combining these PRs requires the separate verified Models caller
adaptation.
That integration patch remains local until the revised Image helper is
available in the base.

### Tested

Candidate `996def6` adds the Go 1.26.9 security pin above reviewed
runtime `70282f3`.
All five reported review findings are fixed, with regression coverage
and resolved threads.
Standard-record printing retains complete fields; Models viewer Ctrl+C
returns 130; q, Escape, and p retain status 0.

At `70282f3`, 46 focused race tests and 206 subcases passed without
failures or skips.
Independent native macOS checks reproduced both original defects and
verified the fixes, terminal restoration, and cleanup.
Additional probes preserve joined errors, writer failures, and existing
typed exit-status precedence.
The earlier `26e23a3` native checks cover narrow IDs, selection, API
errors, and the corrected single-response checker.
Normal and optimized Python checks verify key delivery and failed-write
behavior.

On Go 1.26.9, the unchanged vulnerability scan passed all nine release
targets.
Four focused Models race tests and seven subcases also passed, with no
failures or skips.
The exact native build passes. Module dependencies and counted budget
inputs remain unchanged.
CI passed for `996def6`: 21 checks passed, with two conditional skips.
The build-artifact scan used Go 1.26.9 and found no vulnerabilities
across all nine release targets.
[CI run](https://github.com/openai/openai-cli/actions/runs/37860812082)
and the trusted budget/isolation checks passed.
Merge still uses the required normal merge queue.

Earlier request-loading evidence remains tied to runtime `f739395` and
its 25 public scenarios.
The demos remain tied to `d4a2d744`; their table, navigation, and
loading paths use q and remain unchanged.
Fresh native checks cover the corrected p and Ctrl+C behavior
separately.

Justin's original hang remains unreproduced; controlled wait handling
does not establish its historical cause.
Broader generated-list activation remains separate. No live API calls
ran.
Native Linux/Windows Models behavior remains unverified.

### Demo

The recordings compare ID-only `d16c92b` with ID/owner `d4a2d744` using
48 identical synthetic records.
Both use `openai models list` on macOS arm64 with Menlo terminal replay.
The wide recording includes a controlled slow response and visible
loading feedback.
The narrow recording preserves complete ID/owner labels.
All five commands exited successfully after one identical-response
request each.
The recorder checks navigation, terminal restoration, capture bytes, and
source/binary hashes.
Author and independent reviews passed all 11 screenshots and 46 GIF
frames.
The media shows terminal replay rather than native graphical terminal
appearance.

![Before and after, with slow
loading](https://github.com/user-attachments/assets/3d5426aa-010d-4adc-887d-3500ff2df0aa)

Before:

![Before: IDs
only](https://github.com/user-attachments/assets/af89fd74-ef25-4fbf-977d-22a6fc582816)

After:

![After: IDs and
owners](https://github.com/user-attachments/assets/eca66046-82ff-4654-8259-42c12e512bb1)

[Narrow
comparison](https://github.com/user-attachments/assets/f2095fb5-c6d5-473c-b20d-9d29a093f55f).
[Recording
recipe](https://github.com/openai/openai-cli/blob/cbe90a336390688c7723537cec2c2eeb8c812868/scripts/demos/models-list-viewer/README.md).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants