cccc icon indicating copy to clipboard operation
cccc copied to clipboard

ChatGPT Web Model can leave an existing-chat prompt staged but unsent after submission_ambiguous

Open fostex0329 opened this issue 2 months ago • 1 comments

Summary

ChatGPT Web Model browser delivery can leave the complete CCCC browser batch staged in the ChatGPT composer without actually submitting it.

When this happens:

  • CCCC records submission_ambiguous
  • the prompt is not present in the ChatGPT conversation
  • the prompt remains in the composer
  • at-most-once behavior means it is not automatically resent

With later deliveries enabled, a subsequent prompt overwrites that unsent draft (this is how it first surfaced, as apparent message loss). With serialized delivery, the draft remains intact but the runtime stalls indefinitely.

I want to be precise about the framing: the overwrite is a secondary consequence. The primary problem is that browser submission does not complete after the prompt has already been staged.

Environment

  • CCCC v0.4.40, source references verified against 41616580 (current main at time of writing)
  • ChatGPT Pro account, Web Model Runtime, existing_chat delivery target
  • Reproduced in two independent environments:
    • native macOS with the host Chrome session
    • the official Docker image with Xvfb (no host display, no window focus involved)

Phase 1 — 10-turn unattended soak, later deliveries allowed

  • successful replies: 6 / 10
  • affected turns: 4 / 10 (turns 4, 8, 9, 10), including three consecutive
  • every delivery that reached submitted produced a reply
  • every delivery that ended only at ambiguous never appeared in the conversation

Human observation at the end of the run:

  • turn 4 did not exist anywhere in the ChatGPT conversation
  • turn 10's full Browser batch text was still sitting unsent in the composer

Overwrite chain:

turn 8  staged, not submitted
turn 9  select-all + InsertText replaced it
turn 9  staged, not submitted
turn 10 replaced it
turn 10 survived only because no later turn was ever sent

Phase 2 — Docker + Xvfb, strictly serialized delivery

Each turn waited for the reply before the next was sent.

turn 1  SUCCESS   41s
turn 2  SUCCESS   20s
turn 3  STALLED  360s (no reply; aborted)

Turn 3, captured read-only over CDP (the send control was never pressed):

  • the complete CCCC Browser batch text was present in the composer
  • the message was not present in the conversation
  • no subsequent turn was sent, so no overwrite occurred
  • the draft remained staged indefinitely

Ledger:

browser delivery was interrupted after its at-most-once dispatch fence;
the message will not be redelivered automatically

The payload itself was well-formed. Only submission failed.

What this rules out

The same primary failure reproduced despite:

  • Linux in a container instead of native macOS
  • Xvfb instead of a host GUI
  • no window focus contention of any kind
  • a stable Chrome session (no restarts during the run)
  • serialized delivery with no concurrent next-turn submission

So the failure is not adequately explained by macOS focus behavior, Chrome restarts, concurrent delivery, or next-turn overwrite itself.

Relevant code

Staging and replacement

crates/cccc-web/src/browser_surface/prompt_submission.rs

let composer = wait_for_composer(&page).await?;
let staged = inspect_submission(&page, prompt, &needles).await?;
if !staged.composer_exact {
    focus_and_select_composer(&page).await?;
    page.execute(InsertTextParams::new(prompt)).await
        .context("insert prompt into visible browser composer")?;
}

composer_exact is computed against the new prompt:

composer_exact: Boolean(markedText && markedText === expected),

That works well as an idempotency check, but it collapses two very different states into false:

  • an empty composer
  • a different, still-unsent CCCC draft from a previous delivery

focus_and_select_composer then selects the entire existing contents before insertion, so the second case is silently destroyed.

Ambiguous handling

crates/cccc-web/src/routes/web_model_delivery.rs

if target["last_delivery_status"] == "submission_ambiguous" {
    if recover_verified_ambiguous_submission(...).await? {
        return Ok(DeliveryOutcome::Submitted);
    }
    // The attempted turn was already committed to preserve at-most-once delivery. A known
    // conversation target can therefore continue with later turns without retrying it. A new
    // chat must remain fenced until its conversation URL can be recovered.
    if target["kind"] == "new_chat" {
        return resolve_pending_new_chat(...).await;
    }
}

new_chat is fenced; existing_chat continues. When the ambiguous turn is in fact still sitting in the composer, that is exactly when the next turn overwrites it.

Questions, not a proposed redesign

I am not asking for automatic retry. The at-most-once policy is valuable and should be preserved — replaying after an ambiguous result risks duplicate prompts, which is worse than a stall.

Would any of these be in scope?

  1. Keep a staged-but-unsent prompt recoverable in some form, rather than letting it be abandoned.
  2. Fence later deliveries for an existing_chat while a known staged draft remains unresolved, the way new_chat already is.
  3. Distinguish an empty composer from a different CCCC draft before replacing the contents.
  4. Expose enough browser-delivery / composer state for an operator or external supervisor to reconcile what is actually pending.
  5. Harden the send-control detection and submission path itself.

Possibly related

#109 also concerns browser-surface robustness, though at session-open rather than submission time. I don't think they share a root cause, linking only for context.

Happy to provide the full ledger, the container configuration, or to run additional instrumented reproductions if that helps.

fostex0329 avatar Sep 20 '26 11:09 fostex0329

Thanks for reporting this! We reproduced and fixed a case where a later delivery could overwrite an unsent draft after an unverified submission. CCCC now preserves the draft and pauses delivery until you review ChatGPT and explicitly resume, without automatically resending the uncertain message.

ChesterRa avatar Sep 20 '26 14:09 ChesterRa