Skip to content

[Bug] Preserve composer drafts and pending state during queued sends #42

Description

@MarsLuay

Summary

background.js sendPromptToSpecificTab() replaces the current ChatGPT composer contents before submitting a queued message. If the user has typed an unsent draft while the queue is waiting, that draft can be destroyed. The sender also has no preflight contract for other pending composer state before it injects queued text.

Evidence

  • sendPromptToSpecificTab() selects a contenteditable input, focuses it, and executes input.textContent = '' before inserting the queued message.
  • The function does not first verify that the composer is empty.
  • The function does not preserve/restore the previous composer text if the send attempt later fails.
  • The current sender contract does not report other pending composer state before submission; it only checks the selected input and send button.

Likely root cause

The queued sender appears to treat the ChatGPT composer as a disposable text buffer owned by the automation. That assumption is unsafe because the user can edit the composer independently while a queue is waiting.

Expected behavior

Queued automation must never destroy or silently inherit unrelated user composer state.

Before injecting a queued prompt, the extension should resolve the canonical ChatGPT composer and run a preflight check. If a non-empty user draft or other unsupported pending composer state is present, preserve it and pause/defer the queued send with an actionable reason rather than clearing or combining with it.

A failed send attempt must leave the user's pre-existing composer state intact.

Acceptance criteria

  • A non-empty user draft present immediately before a queued send is never cleared or overwritten by the automation.
  • The sender fails closed or defers when the canonical composer has conflicting pending state instead of submitting a mixed/unknown request.
  • A send-button/selector/submission failure after preflight does not destroy the user's pre-existing draft.
  • A clean canonical composer still accepts normal queued messages without requiring manual intervention.
  • The preflight logic is provider-adapter compatible if [Suggestion] Extract a provider/site adapter boundary before adding Gemini and Claude #38 has landed and does not introduce another independent ChatGPT composer selector stack.
  • Add deterministic tests for empty composer, non-empty draft, failed send after preflight, and conflicting pending composer state.

Relevant code

  • background.js
  • content.js

Blocked by

  • None.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions