(triggers): confirm a chain step's submission by the CLI descriptor (#407) - #410
Conversation
After /compact the next step's Enter was absorbed as a line break while the log said "sent": the level probe was satisfied by the compaction spinner and nothing waited for the CLI to be back at its prompt. A step after /compact now waits for the descriptor to report idle after the compact, and a submission counts only on a busy edge after our Enter, with one recovery Enter and an explicit "not confirmed submitted" otherwise. Without a descriptor the old behaviour is unchanged. Closes #407
|
Reviewing |
|
Adversarial review at |
…wer a dialog A turn too fast to show busy, or a dialog opened by our Enter, is a reaction of the CLI: any status write at or after the Enter proves the submission. The recovery Enter is withheld while the descriptor reads waiting or busy, and a descriptor without an integer statusUpdatedAt is treated as absent. A skipped readiness wait is logged. Refs #407
|
Re-review at |
# Conflicts: # CHANGELOG.md
Closes #407
After a
/compactchain step, the next step's text landed in the composer but its Enter became a line break, while the log saidChain step 1 sent. Two causes: the submission check was a level probe that the spinner ending the compaction satisfied (so the recovery Enter was never armed), and nothing waited for the CLI to be back at its prompt.What changes:
ctx.getCliStatus(sessionId)exposes the CLI's own descriptor (status,statusUpdatedAt) through the cachecli-session-state.jsalready keeps (local sessions only; no new watcher)./compactstep waits forstatus: "idle"with astatusUpdatedAtlater than the compact send, bounded bySWITCHBOARD_CLI_READY_WAIT_MS(default 60 s) and the step deadline; on expiry it proceeds with a warning.busywith astatusUpdatedAtat or after our Enter. Otherwise one recovery\r(existing rules), thenconfirmed: false.submittedonly when confirmed;not confirmed submittedwarning otherwise (neversent). Steps carrysubmit_confirmed, the chain result listsunconfirmed_steps; an unconfirmed step readssubmitted: "assumed". Without a descriptor nothing changes (level probe,sent).Tests (
test/trigger-descriptor-proof.test.js,test/trigger-context.test.js): fake timers and a fake descriptor forsubmitWithVerify/waitForCliIdleAfter(edge confirmed without retry; stale busy plus level spinner gives one retry then unconfirmed; edge after the recovery Enter; no-descriptor fallback; readiness idle/older idle/waiting/timeout/no descriptor), and the real watcher for three chain scenarios. Run against the old code the chain tests fail (no readiness wait, three Enters expected, nounconfirmed_steps). Mutations, each turning at least one test red: removing the readiness wait, dropping thestatusUpdatedAt > afterMsbound, accepting a stale busy edge, falling back to the level probe, logging unconfirmed as info, dropping the timeout warning, marking the recovery always confirmed, forcing edge mode without a descriptor, droppingunconfirmed_steps, an unbounded readiness wait, and (context) answering for remote sessions.Not verified: a real CLI. Whether waiting for the descriptor's idle makes the Enter after
/compactsubmit is the measurement named in the issue (SWITCHBOARD_SUBMIT_ENTER_DELAY_MS50 / 500 / 3000, with and without the wait). A command that never makes the CLI busy (an instant local slash command) is reported unconfirmed after a harmless extra Enter.task check: lint 0 errors; the suite shows only load-dependent flakes in unrelated files (git-changes real-git, passing in isolation) and the knownviewer-file-watchlibuv assertion.