Skip to content

fix: harden GUI-SDL model and Windows ConPTY terminal handling - #18

Merged
m-mdy-m merged 12 commits into
mainfrom
fix/gui-sdl-conpty-review-followups
Nov 6, 2026
Merged

m-mdy-m merged 12 commits into
mainfrom
fix/gui-sdl-conpty-review-followups

Conversation

@m-mdy-m

@m-mdy-m m-mdy-m commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow up the merged GUI-SDL foundation PR #17 with the review corrections and the Windows terminal fix required by CDIN's live TUI smoke.

  • Open the attached Windows console devices via CONIN$/CONOUT$ when ConPTY or redirected standard streams are pipes; preserve/restore console modes and close only handles owned by the adapter.
  • Keep Runtime-owned selection state out of the GUI presentation model.
  • Enforce strictly increasing snapshot revisions.
  • Correlate view.lines responses with the outstanding first-line, line-count and document-version request; cancel the request when a newer document version commits.
  • Require pixel attach units for GUI-SDL and ignore SDL keyboard/text/focus/resize/close events addressed to other windows.
  • Add regression coverage for wrong line windows, equal snapshot revisions, pixel units and foreign-window input.
  • Refresh GUI-SDL/TUI documentation and the repository README.

Verification

  • Frontend native Linux/macOS/Windows CI — passed in run 42309550750
  • SDL3 model and adapter smoke under AddressSanitizer — passed in run 42309550750
  • CMake install/export consumer and Pipeline quality checks — passed in run 42309550750
  • CDIN PR #110 Windows ConPTY live TUI smoke with the new pinned Frontend commit

Scope

This is a hardening follow-up for Issue #15, not completion of the full desktop editor. PaneTree rendering, production Unicode shaping/bidi/IME, full selection/cursor presentation, panels/widgets and release-grade device-loss recovery remain open acceptance work.

Latest CI result — 2026-11-07

All Frontend-owned checks now pass for head 1fb73848966af166ec9c0b8f1ca317247563649d: Windows, Linux, macOS, Pipeline quality, SDL3 AddressSanitizer model/adapter tests, installed package and clean-prefix downstream CMake consumer. See run 42309550750.

The five review findings on merged PR #17 have been corrected here and their original review threads are resolved. CDIN's cross-repository live integration is still a separate outstanding gate; PR #110 pins this exact Frontend commit and must pass its new Windows ConPTY and three-platform E2E run before this integration fix is considered verified end-to-end.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T23:08:39.507569Z 258e93d PR opened
ℹ️ 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.

m-mdy-m commented Nov 6, 2026 •

Copy link
Copy Markdown
Member Author

Verification update — 2026-11-07

All Frontend-owned CI checks are now green for PR #18 head 1fb73848966af166ec9c0b8f1ca317247563649d in run 42309550750:

  • Windows, Linux and macOS native jobs
  • Pipeline quality
  • SDL3 adapter/model tests under AddressSanitizer
  • Install/export and clean-prefix downstream CMake consumer

The five findings on merged PR #17 have been corrected in this follow-up and all five review threads on #17 are resolved. The only pending integration check is CDIN PR #110's live GUI/TUI path using this exact pinned Frontend commit. PR #18 remains open for review; the remaining GUI product/release scope is tracked in Issue #15.

@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: 258e93d503

ℹ️ 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".

return -1;
}
}
if (!ReadFile(context->input, buffer, requested, &read_count, NULL)) return -1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve nonblocking Windows terminal drains

When the readiness-driven TUI loop drains terminal input until AGAIN, this unconditional ReadFile can block on the next call after the current console input is consumed, preventing the loop from servicing Backend readiness. The removed availability check specifically prevented that second read from blocking; restore a nonblocking empty-input result.

Useful? React with 👍 / 👎.

Comment on lines +95 to +99
context->input = CreateFileW(
L"CONIN$", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (context->input == INVALID_HANDLE_VALUE) return -1;
context->owns_input = 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Make the ConPTY readiness wait use CONIN$

In the redirected-stdio ConPTY fallback, terminal_read now reads from CONIN$, but this leaves STD_INPUT_HANDLE unchanged. The standalone preview waits on GetStdHandle(STD_INPUT_HANDLE) in wait_for_terminal_input(); when that redirected pipe has no writer, keyboard input on CONIN$ will not wake the wait. Keep the readiness handle aligned with the handle being read, or expose the console handle to the wait bridge.

Useful? React with 👍 / 👎.

Comment on lines +168 to +169
assert(cdin_frontend_gui_sdl_create(&config, &gui) ==
CDIN_FRONTEND_GUI_SDL_INVALID_ARGUMENT);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject cell-unit sessions in the SDL adapter

With cell_session.units = "cells", cdin_frontend_gui_sdl_create() still succeeds because its validation does not check session->units. This new assertion therefore fails when the SDL adapter smoke runs, and the adapter can send pixel dimensions as cell-based resizes; reject non-pixel sessions in the production create path.

Useful? React with 👍 / 👎.

@m-mdy-m
m-mdy-m merged commit f03266e into main Nov 6, 2026
5 checks passed
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.

1 participant