Skip to content

(triggers): after /compact, a chain step's Enter becomes a line break and the step is logged as sent #407

Description

@devsuitup

After a /compact chain, step 1 ("Reprise après compaction : …") lands in the composer but its Enter becomes a line break; the message sits unsent while main.log says Chain step 1 sent (e.g. 2026-10-01 22:15:49 on 7615734f, step 0 at 22:13:52). Recurring.

What the code shows (at 4608df0)

  • submitToPty (trigger-watcher.js ~154-161) writes the text in one write, waits DEFAULT_SUBMIT_ENTER_DELAY_MS = 50 ms, then writes \r alone. No bracketed paste, no multi-line.
  • The "sent" log is emitted after submitWithVerify whatever happened. The verify (pollForBusyObserved ~316-338) is a level probe: any _cliBusy=true within 2 s passes, and _cliBusy comes from OSC titles / OSC 9;4 — so the spinner that ends a compaction satisfies it and the recovery Enter is never armed.
  • .ai/contexts/trigger-watcher.md (~741-752) already records the 0.0.64 case where even a lone retry \r, seconds later, was absorbed as a newline: the CLI's post-compaction state, not the 50 ms timing, eats the Enter. fix(triggers): close two false-confirm gaps in chain submission verify #185 (settle), fix(triggers): make waitForBusyFall wait for the busy rise #190 (busy-rise wait) and the midBusy gate did not touch that.

Proposal

  • Readiness: before a step that follows /compact, wait for the CLI's own descriptor (~/.claude/sessions/<pid>.json) to say status: "idle" with a statusUpdatedAt after the compact step (read at CLI 2.1.286: idle = at the prompt, waiting = a dialog is open, busy = working), bounded.
  • Proof of submission: an edge, not a level — the descriptor going idle→busy after our write, or the transcript gaining the user line; otherwise one recovery Enter, and if that still does not submit, log a warning that names it instead of "sent".

Deciding measurement (isolated instance, real CLI): /compact → text with SWITCHBOARD_SUBMIT_ENTER_DELAY_MS 50 / 500 / 3000, with and without waiting for the descriptor's idle.

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions