GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tui: pending question form lost after client reconnect — unexitable modal (FormNotFoundError loop) · Issue #44471 · anomalyco/opencode

tui: pending question form lost after client reconnect — unexitable modal (FormNotFoundError loop) #44471

New issue
Copy link
New issue
Copy link
Closed
Closed
tui: pending question form lost after client reconnect — unexitable modal (FormNotFoundError loop)#44471
Copy link
Assignees
kommander
Labels
2.0

Description

@emonakov
emonakov
opened on Aug 23, 2026
Issue body actions

Summary

When the TUI's connection to the shared background service drops while an agent-initiated interactive question form is pending, the server discards the pending form and does not restore it on reconnect. The TUI keeps its stale modal mounted; every subsequent keypress produces a 404 FormNotFoundError unhandled rejection, keyboard input stays trapped in the dead modal, and the terminal must be killed to recover.

Environment

  • opencode version: opencode2 v0.0.0-beta-17963 (channel: beta)
  • OS: Darwin 25.5.0 arm64
  • Terminal: WarpTerminal
  • Shell: /bin/zsh
  • Install/channel: beta, shared background service (opencode2 service status reported http://127.0.0.1:)
  • Active plugins: several local plugins are configured, but all failed schema validation at load time in this session ("Expected object at ["default"]"), so the failure occurred with no custom plugins active.

Reproduction

  1. Start the TUI against the shared background service.
  2. Trigger a tool call that opens an interactive question form and leave it pending.
  3. Drop the client↔server connection while the form is open. In my case the drop happened on its own ~10 minutes into the wait; server logged location services evicted for the project directory.
  4. Client silently reconnects (~45 s later; server re-runs location services boot and plugin load).
  5. Press any key in the still-displayed form (Enter or Esc).

Observed once so far; likely reproducible whenever the connection drops while a form is pending.

Expected Behavior

Either the server persists and restores pending forms across client reconnects, or the client detects the stale form (404 / FormNotFoundError) and dismisses the modal, returning keyboard control to the user.

Actual Behavior

  • On reconnect the TUI replayed its pending answer: POST /api/session/:id/form/:formId/reply → 404.

  • Every later keypress produced another 404 on /reply or /cancel plus an unhandled rejection in the CLI log:

    level=ERROR role=cli message="unhandled rejection" cause._tag=FormNotFoundError cause.message="Form not found: frm_…"
    
  • 77 such rejections over ~100 seconds.

  • The modal remained mounted and captured all keyboard input; Esc/Ctrl+C did not work; only killing the terminal recovered.

  • The assistant message was left incomplete with the tool stuck in running; the session ended as interrupted.

Additional Context

  • Server side of the same window: repeated Sent HTTP response … http.url=/api/session/<id>/form/<formId>/reply http.status=404 and matching /cancel 404s after the reconnect.
  • No pending permission remains queryable afterwards (GET /api/session/:id/permission → empty).
  • Workaround: kill the terminal, start a new session. The run's completed work is intact; only the unanswered question is lost.
  • Session/form IDs redacted. Happy to provide a fuller sanitized log excerpt.

Activity

  1. github-actions
    assigned
    kommander
    on Aug 23, 2026
  2. opencode-agent
    added
    2.0
    on Aug 23, 2026
  3. neriousy commented on Oct 22, 2026

    @neriousy
    neriousy
    on Oct 22, 2026
    Member
    More actions

    The unexitable modal is fixed in #44516: when the server no longer knows a form, the client now drops it instead of looping on FormNotFoundError. Keeping pending forms across a reconnect or eviction is tracked in #52599 (PRs #51583 and #52600), so closing this in favor of that.

  4. neriousy
    closed this as completedon Oct 22, 2026
  5. Saka-CS commented on Oct 27, 2026

    @Saka-CS
    Saka-CS
    on Oct 27, 2026
    More actions

    Attempted to reproduce this on v2.1.2 and it no longer reproduces on this setup.

    Environment

    • opencode v2.1.2, TUI in Ghostty 1.3.1 (TERM=xterm-ghostty) on Hyprland 0.56.2, Linux x86_64
    • Dedicated isolated server (opencode serve --port 4599 with OPENCODE_PASSWORD set so the password survives a restart), TUI attached with --server http://127.0.0.1:4599 --session <id> — the shared background service was not touched
    • Question forms created with POST /api/session/{id}/form and state checked with GET /api/session/{id}/form/{formId}

    Steps

    1. Pending question form on screen in the TUI.
    2. Kill the server process and start it again on the same port (pending forms are process-local, so this simulates the form being discarded while the client keeps its modal).
    3. Client reconnects (~10 s), then press Down / Escape / Enter / Ctrl+C.

    Result

    • Server-side the form is gone after the restart: GET /api/session/{id}/form/{formId} returns FormNotFoundError as expected.
    • The TUI does not keep the stale modal: the dialog is dismissed on reconnect, keyboard control returns to the prompt, and Down / Escape / Enter / typing all work normally.
    • 0 FormNotFoundError and 0 unhandled rejections in the client log after the reconnect (I counted new log lines since the restart).
    • Only the unanswered question is lost, which matches the expected behavior in the report.

    I also tested the related trigger of two clients on the same session: question form visible in both TUIs, answered in client A. Client B's dialog disappeared cleanly within ~3 s, no 404s, no trapped keyboard.

    Caveat: forms were created through the API rather than by the model calling the question tool, and a server restart is only a proxy for the original location-eviction trigger. But the client-side stale-modal handling does look fixed on 2.1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @kommander
    kommander

Labels

2.0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.