diff --git a/docs/decisions/0029-rig-reply-end-needles-are-exchange-unique.md b/docs/decisions/0029-rig-reply-end-needles-are-exchange-unique.md index 0b46d6f..c21d222 100644 --- a/docs/decisions/0029-rig-reply-end-needles-are-exchange-unique.md +++ b/docs/decisions/0029-rig-reply-end-needles-are-exchange-unique.md @@ -5,6 +5,8 @@ - **Implements:** [issue #125](https://github.com/fluxvale/dashfloat/issues/125). - **Pattern precedent:** the F7 caveat's own remedy (`wait_for` a content needle, not quiet) — this ADR makes that remedy structurally safe. +- **Amendment:** [2026-11-02, issue #143](#amendment-2026-11-02-issue-143-the-episodes-queue-is-dropped-not-wired) + (the never-landed episode dispatch is void — the queue was deleted). ## Context @@ -63,7 +65,8 @@ replay into a snapshot screen is heavy machinery for a rig). - A future episode dispatch in the mock must pop `EPISODES` before taking a stock number — episode replies carry their own unique text and take none - (marked at the counter in `_sse`). + (marked at the counter in `_sse`). *(Voided — 2026-11-02, #143: the + queue was dropped, never wired — see the amendment below.)* - If the app ever retries a stock request on a new connection, the retry takes the next number and the scenario's wait times out — a loud capture failure, which is the rig's contract (fail, never ship). @@ -88,3 +91,27 @@ replay into a snapshot screen is heavy machinery for a rig). diff), no wait draws from the stock body or `REPLY_TOKENS`, the reply-end family rides `stock_closing` (site count never shrinks), and both waits match wrap-collapsed text. It is red on the pre-fix rig by construction. + +## Amendment (2026-11-02, issue #143): the EPISODES queue is dropped, not wired + +**Status:** Accepted (the owner's standing default — dead code misleads — +declared by the operating PA and not countermanded; the fork and its +reversibility are recorded in issue #143 and its closing PR, and the +morning-revert path below). +The Context's "separate follow-up" is resolved: of the wire-or-drop fork, +the rig **drops** the interaction-surface episode machinery. + +- **Deleted:** `MockHandler.EPISODES`, `App.script/1`, the never-landed + vet dispatch (`VET_REPLY`, `is_vet_request` — zero callers since the + #141 era), the four unreachable scenarios (`approve-choice`, + `question-single`, `question-multi`, `auto-reject` — never in the + argparse menu), their dispatch branches, and their entries in the + needle allowlist. The sentinel-site floor (≥9) is untouched: those + scenarios waited on literals, not `stock_closing`. +- **Kept:** the shipped captures in `docs/screenshots/133–135/` as frozen + evidence — the widget behavior they prove is app behavior (ADR 0028) + with its own unit/integration tests; only the rig's ability to + regenerate them died (with the queue, not with this ADR). +- **If the owner rules wire-in-the-morning:** revert the squash — the + scenarios' text is in git history, and the wiring rule this ADR + recorded (pop before taking a number) is the design to implement. diff --git a/scripts/capture.py b/scripts/capture.py index a856af4..5d56f7f 100644 --- a/scripts/capture.py +++ b/scripts/capture.py @@ -748,21 +748,9 @@ class MockHandler(BaseHTTPRequestHandler): def log_message(self, *args): pass # silence — the mock never talks over the capture - # The interaction-surface captures (issues #133/#134/#135): a FIFO of - # scripted episodes — ("tools", [(id, name, args_json), ...]) a - # tool-calling episode, ("text", "...") that prose. DEAD, kept only so - # the episode-dependent scenarios still enqueue: nothing pops this - # queue (the consumer was lost in the #133–#135 era; #142 deleted its - # unused corpse and this note replaced the false claim), so those - # scenarios cannot regenerate — see issue #143 for the wire-or-drop - # decision. The vet's own fresh-context completion is detected by its - # instruction and answered with VET_REPLY (issue #135's still). - EPISODES: list = [] - VET_REPLY = '{"decision":"confirm","reason":"deletes files outside the project"}' # Stock replies are numbered per App run (App.__init__ resets this): # the n-th streamed stock reply closes with stock_closing(n) (#125, - # ADR 0029). Episode replies carry their own unique text and take no - # number. + # ADR 0029). STOCK_REPLIES = itertools.count(1) def _json(self, payload, status=200): @@ -810,15 +798,6 @@ def do_POST(self): else: self._json({"choices": [{"message": {"content": GHOST_TEXT}}]}) - # The AUTO safety check (ADR 0016 §6): a fresh-context user message - # whose prose is the vetter's static instruction. - @staticmethod - def is_vet_request(req): - users = [m for m in req.get("messages", []) if m.get("role") == "user"] - if not users: - return False - return "safety check" in content_text(users[-1].get("content", "")) - def _sse(self, req): self.send_response(200) self.send_header("Content-Type", "text/event-stream") @@ -846,9 +825,7 @@ def _sse(self, req): time.sleep(0.09) reasoning_deltas += 1 # This connection's stock number (#125): the reply closes with it, - # making the exchange's end a unique needle. A future episode - # dispatch must pop EPISODES HERE and take no number for episode - # replies — their text is already unique. + # making the exchange's end a unique needle. n = next(MockHandler.STOCK_REPLIES) for token in REPLY_TOKENS[:-1] + stock_closing_tokens(n): frame = {"choices": [{"delta": {"content": token + " "}}]} @@ -1872,139 +1849,6 @@ def scenario_drop_refusal(self): assert "rest" not in self.text(), \ "the refusal still streamed a reply — a request went out" - # -- the interaction surface (issues #133/#134/#135, ADR 0028) -------- - - # Enqueue the scripted episodes the mock pops one per chat connection - # (a tool-calling episode, then the post-answer reply). - def script(self, *episodes): - MockHandler.EPISODES.extend(episodes) - - UP, DOWN, SPACE, ENTER, ESC = (b"\x1b[A", b"\x1b[B", b" ", b"\r", b"\x1b") - - # The approval as a choice question (#133): the composer is replaced by - # "Approve write_file?" with [Approve, Reject] — the preview stays the - # evidence in the log — arrows move, Enter answers, the tool runs and - # the result rows in. Each act asserted before recording. - def scenario_approve_choice(self): - self.script( - ("tools", [("call_w", "write_file", - json.dumps({"path": "tmp/capture-approve.txt", - "content": "approved by the choice widget\n"}))]), - ("text", "File written.")) - self.type("add the capture fixture file") - self.send(b"\r") - self.wait_for("Approve write_file?", timeout=10) - assert self.find_row("❯ Approve") is not None, \ - "the approval's Approve option never rendered" - assert self.find_row(" Reject") is not None, \ - "the approval's Reject option never rendered" - assert self.find_row("↑↓ move · ⏎ answer · esc reject") is not None, \ - "the approval's hint row is clipped — the keys are unreadable" - self.wait_quiet() - # Move to Reject and back — the motion the GIF must show — then - # approve. - self.send(self.DOWN) - time.sleep(0.4) - assert self.find_row("❯ Reject") is not None, \ - "Down never moved the approval's selection to Reject" - self.send(self.UP) - time.sleep(0.4) - self.send(self.ENTER) - self.wait_for("write_file → ok", timeout=10) - self.wait_for("File written.", timeout=10) - self.wait_quiet() - - # The model's question, single-select (#134): the same widget asks the - # user, Enter returns the answer as the tool result, and the model acts - # on it in the next episode's reply. - def scenario_question_single(self): - self.script( - ("tools", [("call_q", "question", json.dumps({ - "question": "Which database should the config target?", - "options": [{"label": "Postgres", "description": "the sturdy default"}, - {"label": "SQLite"}], - "multiple": False}))]), - ("text", "SQLite it is — minimal setup, one file.")) - self.type("set up the database config for me") - self.send(b"\r") - self.wait_for("Which database should the config target?", timeout=10) - assert self.find_row("❯ Postgres") is not None, \ - "the question's first option never rendered selected" - assert self.find_row("SQLite") is not None, \ - "the question's second option is clipped" - assert self.find_row("↑↓ move · ⏎ answer · esc dismiss") is not None, \ - "the question's hint row is clipped" - self.wait_quiet() - self.send(self.DOWN) - time.sleep(0.4) - self.send(self.ENTER) - self.wait_for("question → answered: SQLite", timeout=10) - self.wait_for("SQLite it is", timeout=10) - self.wait_quiet() - - # The model's question, multi-select (#134): space toggles, Enter - # answers every checked label in option order. - def scenario_question_multi(self): - self.script( - ("tools", [("call_m", "question", json.dumps({ - "question": "Which runtimes need setup docs?", - "options": [{"label": "Elixir"}, {"label": "Rust"}, - {"label": "Python"}], - "multiple": True}))]), - ("text", "Docs for Elixir and Python, coming up.")) - self.type("write setup docs for the runtimes i use") - self.send(b"\r") - self.wait_for("Which runtimes need setup docs?", timeout=10) - assert self.find_row("[ ] Elixir") is not None, \ - "the multi question's checkboxes never rendered" - assert self.find_row("[ ] Python") is not None, \ - "the multi question's last option is clipped" - assert self.find_row("space toggle") is not None, \ - "the multi question's hint row is clipped" - self.wait_quiet() - self.send(self.SPACE) # check Elixir - time.sleep(0.4) - assert self.find_row("[x] Elixir") is not None, \ - "Space never checked Elixir" - self.send(self.DOWN) - time.sleep(0.3) - self.send(self.DOWN) - time.sleep(0.3) - self.send(self.SPACE) # check Python - time.sleep(0.4) - assert self.find_row("[x] Python") is not None, \ - "Space never checked Python" - self.send(self.ENTER) - self.wait_for("answered: Elixir, Python", timeout=10) - self.wait_for("Docs for Elixir and Python", timeout=10) - self.wait_quiet() - - # AUTO never asks (#135): the dangerous call auto-rejects with the - # safety check's reason — the preview receipt, the [auto: rejected] - # entry, the tool-result row — and NO approval ever renders. Still - # capture (the transcript record, not motion). - def scenario_auto_reject(self): - self.script( - ("tools", [("call_x", "execute_command", - json.dumps({"command": "rm -rf /tmp/precious"}))]), - ("text", "Understood — that command was refused. I will list what " - "is safe to delete instead.")) - self.type("/mode auto") - self.send(b"\r") - self.wait_for("[mode: Build → Auto]", timeout=10) - self.type("clean up the precious directory") - self.send(b"\r") - self.wait_for("[auto: rejected execute_command — deletes files " - "outside the project]", timeout=15) - self.wait_for("auto-rejected: deletes files outside the project", - timeout=10) - self.wait_for("Understood — that command", timeout=10) - assert self.find_row("Approve execute_command?") is None, \ - "AUTO prompted an approval — the leak the issue reports" - assert self.find_row("Approve this change?") is None, \ - "AUTO armed the confirming activity row" - self.wait_quiet() - # The Tab-complete flow (issue #105; ADR 0020 amendment): "/mod" + Tab # completes to the highlighted head "/mode " (registry order — mode # precedes model; popup closes), then "/c" + down + Tab completes the @@ -2821,12 +2665,6 @@ def assert_claims(): app.scenario_attach_cjk() elif args.scenario == "drop-refusal": app.scenario_drop_refusal() - elif args.scenario == "auto-reject": - # The transcript record (#135): preview receipt, the - # [auto: rejected] entry with the check's reason, the - # auto-rejected result row, the model's adaptation — and - # the scenario itself asserts NO approval ever rendered. - app.scenario_auto_reject() elif args.scenario == "model-switch": app.scenario_model_switch() elif args.scenario == "resume-picker": @@ -3008,28 +2846,6 @@ def assert_claims(): app.scenario_drop_image() time.sleep(0.5) app.gif(args.out, crop_rows=24, min_span=1.0) - elif args.scenario == "approve-choice": - # The approval in motion (#133): the composer is replaced by - # the choice question, Down/Up move the selection, Enter - # approves and the tool's result rows in. Each act asserted by - # the scenario before the GIF is written. Full frame. - app._mark = time.monotonic() - app.scenario_approve_choice() - time.sleep(0.5) - app.gif(args.out, crop_rows=24, min_span=1.0) - elif args.scenario == "question-single": - # The model's question in motion, single-select (#134). - app._mark = time.monotonic() - app.scenario_question_single() - time.sleep(0.5) - app.gif(args.out, crop_rows=24, min_span=1.0) - elif args.scenario == "question-multi": - # The multi-select flow (#134): space toggles two answers, - # Enter returns both in option order, the model acts on them. - app._mark = time.monotonic() - app.scenario_question_multi() - time.sleep(0.5) - app.gif(args.out, crop_rows=24, min_span=1.0) elif args.scenario == "growing-session": # Mark BEFORE the first send: the GIF covers both turns — the # span appears with the first turn's persist and grows with the diff --git a/test/dash_float/rig_needle_test.exs b/test/dash_float/rig_needle_test.exs index a5666ac..ec5b015 100644 --- a/test/dash_float/rig_needle_test.exs +++ b/test/dash_float/rig_needle_test.exs @@ -52,19 +52,6 @@ defmodule DashFloat.RigNeedleTest do "of 1048576", "window assumed", "DASHFLOAT_CONTEXT_TOKENS", - "write_file → ok", - "File written.", - "Approve write_file?", - "Which database should the config target?", - "SQLite it is", - "question → answered: SQLite", - "Which runtimes need setup docs?", - "answered: Elixir, Python", - "Docs for Elixir and Python", - "[mode: Build → Auto]", - "auto-rejected: deletes files outside the project", - "[auto: rejected execute_command — deletes files ", - "Understood — that command", "[session titled: {TITLE_TEXT}]", "[session titled: {TITLE_FREE_TITLE}]", "[session titled: {TITLE_INLINE_TITLE}]"