Skip to content

fix(cli): monitor prompt handoff no longer races repaint teardown - #105973

Merged
teknium1 merged 1 commit into
mainfrom
fix/monitor-paint-ci
Sep 8, 2026
Merged

teknium1 merged 1 commit into
mainfrom
fix/monitor-paint-ci

Conversation

@teknium1

@teknium1 teknium1 commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

CLI monitor repaint requests no longer race the nested application's event-loop teardown.

  • Route both immediate modal paints and spinner-thread monitor refreshes through one monitor repaint entry point on the existing UI-loop scheduler.
  • Capture the application once, so monitor detachment cannot change the target between checks.
  • Extend the existing prompt-handoff invariant with event-synchronized teardown for both callers; retain all five prompt types, ordinary-paint behavior, dock suppression, and secret draft restoration. No added sleep or timeout increase.

Root cause: prompt_toolkit's thread-safe invalidate() reads app.loop multiple times; a queued modal frame can finish the nested application between those reads and leave a worker calling call_soon_threadsafe(loop=None).

This was found in the first-attempt output of CI run 34263993728 for #105960 (retry passed), not a reported user-machine incident. This PR is separate from the UI work and does not modify it.

Validation

Check Result
Event-synchronized current-main reproduction Both modal and spinner-tick cases fail with RuntimeError: no running event loop; unchanged secret test passes
Fixed invariant stress, canonical runner, retries disabled 10 complete file runs, 3 passing cases each, zero failures
Live repro: native Linux PTY, real HermesCLI layout, nested in_terminal() monitor and secret callback Controlled before: exact RuntimeError; controlled after and uninstrumented fixed control: no errors, monitor stopped, original draft and cursor restored
Canonical tests/cli/ + tests/hermes_cli/, retries disabled 987 files: 10,619 passed, 1 failed, 137 skipped. Sole failure is the separately addressed root-home fixture in #105920; no duplicate fix here
Final modified test after explicit ordinary-frame synchronization Canonical 10-run stress passed
Static checks Ruff, Windows-footgun scan, compat-pointer check, diff whitespace passed

Native evidence uses a disposable credential-free profile and the shipped CLI widget/callback implementations; it controls worker scheduling to reproduce the race, not a live model request or historical CI scheduler replay. An earlier interrupted directory run also hit test_update_success_when_head_moves; the completed directory run passed that file.

Infographic

CLI monitor repaint safety

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels Sep 8, 2026
@teknium1
teknium1 force-pushed the fix/monitor-paint-ci branch from 518a1e0 to 497ef9e Compare September 8, 2026 20:29
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 497ef9e — fix(cli): keep monitor repaints safe during prompt handoff

⚠️ Warnings

OSV vulnerability scan · View job

28 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 7m1s vs 5m54s (+18.9%). 5 job(s) slower, 8 faster, 1 unchanged.

  • OS-specific tests / Windows-only tests: -34.0s
  • Python lints / Windows footguns (blocking): +19.0s
  • OS-specific tests / macOS-only tests: +6.0s
  • Python lints / ruff enforcement (blocking): +5.0s
  • Python tests / Run tests: -4.0s

@teknium1
teknium1 merged commit 22488b8 into main Sep 8, 2026
37 checks passed
@teknium1
teknium1 deleted the fix/monitor-paint-ci branch September 8, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants