Skip to content

Input text should be per-session: switching sessions should not carry over or lose draft text #14263

Closed

Description

@uriva

Description

When you type text in the input box on a session and then switch to another session (via session list or new session), the text either carries over to the new session or gets lost. Instead, each session should maintain its own independent input buffer — switching away should save the draft, and switching back should restore it.

Expected Behavior

  • Type text in the input box on Session A
  • Switch to Session B → Session B should have an empty input (or its own previously saved draft)
  • Switch back to Session A → the text you typed should still be there

Each session should have its own independent input state, similar to how tabs work in a text editor.

Actual Behavior

  • Text typed in one session either carries over to the next session (polluting it) or is lost entirely
  • There is no per-session input state — the input buffer is shared globally

Steps to Reproduce

  1. Start opencode, create or open a session (Session A)
  2. Type some text in the input box (but don't send it)
  3. Switch to a different session (Session B) via Ctrl+P → session list
  4. Observe: the text from Session A either appeared in Session B or was lost
  5. Switch back to Session A
  6. Observe: the draft text is gone

Additional Context

The Prompt component uses a single store for input state. When props.sessionID changes, only the placeholder is updated — the input text is not saved or restored per session. An in-memory Map<sessionID, PromptInfo> could be used to save/restore input state on session switches.

Operating System

All platforms

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Feb 19, 2026
  2. github-actions commented on Feb 19, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If these cover the same underlying need, consider commenting on the existing issue instead or linking them.

  3. ariane-emory commented on Feb 19, 2026

    @ariane-emory
    Contributor

    This seems like undesirable behaviour. Your reproduction steps describes precisely what I would do if I had initially accidentally typed my input in the wrong session. Upon accidentally typing input into the wrong session, it is convenient to be able to easily carry that input over to the correct session.

  4. uriva commented on Feb 20, 2026

    @uriva
    Author

    I think the repro steps are a bit confusing - the text should persist per session, even if you close opencode.

    What I'm describing is the standard behaviour in all text UI I can think of: whatsapp, vscode copilot chats, chrome address bar, ubuntu terminal...

    The current nonstandard behaviour made me type wrong input in wrong sessions often.

    If you type in the wrong session as you described, you should have a shortctut copy all text, then delete all text so you can esasily fix this.

    Also sometimes you write some thought to yourself but don't want to queue them yet, and these are obviously per session.

  5. added a commit that references this issue on Feb 26, 2026
    2070847
  6. github-actions commented on Apr 23, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions