Skip to content

Inbox: an agent can replace an earlier question - #1838

Merged
backnotprop merged 2 commits into
mainfrom
feat/inbox-replaced-questions
Oct 11, 2026
Merged

backnotprop merged 2 commits into
mainfrom
feat/inbox-replaced-questions

Conversation

@backnotprop

@backnotprop backnotprop commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

An agent can now replace an earlier question in an Inbox thread, or say it no longer applies. Built per the owner-approved design: direction A "Quiet", with every recommended default. The design record is not in this repo.

Agent side

  • send_message takes supersedes: ["<message id>"] (every open question of that message) or ["<message id>/<key>"]. So does submit_guide, through SEND_ROUTING_FIELDS.
  • A question block can also carry Replaces: <message id>/<key>. Core's parser reads it whenever the value starts with msg_ or q-, wherever the line sits.
    • It is never the prompt and never context, and it does not change the key.
    • Any other Replaces: line stays prose.
  • What replaces the old question:
    • A Replaces: line names its own block's question.
    • The argument names the new message's only question when the message asks exactly one. Otherwise the key is null, and the old card reads "No longer applies".
  • Each id must name an open or picked question of the thread the message lands in. If one does not, the whole send is refused with invalid_supersedes: …, which names each bad id and lists the thread's open questions (<message id>/<key> (<prompt>), also in open_questions).
  • SUPERSEDES_DESCRIPTION is the field's own description, so it reaches the model whole. The send_message description is unchanged, and the guide's working part still survives the 2,048-character cut.
  • plannotator inbox --help documents supersedes and Replaces:, with an example the test parses. The plannotator skill and the marketing reference also cover them.
  • The connection contract needed no change: plannotator_inbox is built from tools/list, and a test checks that supersedes comes through.

Store (append-only)

  • After the new message and its questions, the store appends one more question line per superseded question, carrying superseded_by. Any decision draft on it is dropped.
  • Derived state superseded wins over closed. Old stores replay unchanged.
  • The generated op model in store.test.ts now includes supersedes, so round-trip, seq and routing-determinism properties all cover it.
  • Picks, Send and the decision switch on a superseded question answer 422 question_superseded.
    • A saved pick stays on the record and is never sent.
    • It is never "Answered, not sent", never brings back "Not sent · Send", and never counts in "N picks".
    • The reply's answers section leaves it out entirely: it is neither answered nor "Unanswered".
  • The list counts only open questions:
    • Replaced by a stopped question, the row stays in Stopped on you.
    • Withdrawn whole, the row moves to New since you looked behind the held "1 new", then to Quiet once opened.
  • A subject derived from a question follows the superseded_by chain. The root records subject_question; older roots are inferred. An agent's own subject never changes, and neither does the subject after a withdrawal.

Window

  • The Quiet card shows:
    • the tag "Replaced" or "No longer applies", in neutral grey
    • the row "Replaced at by <new prompt ↓>", or " said at that this no longer applies. Read why ↓"
    • "Your pick: Not sent"
    • the old options folded behind "Show the old options"
    • no answer controls
  • The newer card says "Replaces <old prompt ↑>. Your pick there was not sent."
  • Links between the cards scroll, focus and briefly ring the target, with no motion under reduced motion.
  • The stale guard: if a pick is replaced while the thread is open, a notice appears above the reply box and the pick chip becomes a struck "1 pick on a replaced question". Send then sends nothing and shows an inline panel instead:
    • Actions: Answer the new question (keeps the draft), Send your words only (shown only when something else is in the reply), and Keep editing.
    • Esc is Keep editing. Focus moves into the panel and returns to Send.
    • It shows once per replacement.
    • A 422 race at Send shows the same panel.
  • @plannotator/ui gets two additive Viewer seams, renderQuestionCard and renderQuestionBelowPrompt, documented in its README and HANDOFF. They add no stylesheet classes; the guides.show manifest check is in sync.

Phone (Workspaces repo): the wire is additive

  • InboxQuestion.state can now be "superseded".
  • InboxQuestion.superseded_by: { message_id, key: string | null } | null, also on the stored question record.
  • InboxMessage.supersedes?: string[]: what the agent asked for.
  • InboxMessage.subject_question?: string | null, on a root.
  • The door's picks and reply answer 422 question_superseded (with superseded_by); the decision switch answers the same.
  • The send result gains superseded: string[].

The surface in this repo draws no question cards; the shell draws message bodies natively. So on the phone, a superseded card should be locked like any card that is not open or picked, and drawn as the Quiet card.

Tests

  • packages/shared/inbox/store-supersede.test.ts: supersede by key, by message and by Replaces:; replay and append-only; idempotency; refusals; picks never sent; decision draft dropped; sections; derived subject and chain.
  • packages/server/inbox-supersede.test.ts: the real server through the MCP SDK client: supersedes, Replaces:, invalid_supersedes listing the open keys, submit_guide and the agent-tool schema, and 422 on picks, Send and the decision switch. It puts a tailscale trap first on PATH.
  • packages/inbox/replaced.test.tsx (DOM, added to the test.yml list): the card, the links, the no-replacement card, and the stale guard (once, Esc, words only, Answer the new question, the 422 race).
  • tests/e2e/inbox-replaced.spec.ts: Playwright on the compiled binary.
  • Core parser tests for Replaces:; the inbox-help guide test.

Push (review follow-up)

  • A message that supersedes any question now always sends the phone push, even when it asks nothing new. The summary then has question: null, so no lock-screen answer actions, and it collapses over the stale notification on the thread's collapse id. The summary's shape is otherwise unchanged.
  • The push's question is only ever an open question.
  • Test: packages/server/inbox-relay-push.test.ts, with a fake loopback relay; envelopes are opened with the phone's key.

Review fixes

  • Replaces: is read only when every token on it is id-shaped. Lines such as Replaces: q-learning with PPO… and Replaces: msg_ queue drain… stay prose.
  • A pick or decision switch that meets question_superseded sets no error; the thread is read again and the card redraws as Replaced.
  • Two blocks naming the same old question are refused with invalid_supersedes.

send_message (and submit_guide) take supersedes: ["<message id>"] or
["<message id>/<key>"], and a question block can carry a
Replaces: <message id>/<key> line (never the prompt). A superseded question
derives state "superseded" with superseded_by { message_id, key | null };
answering it is refused 422 question_superseded, a pick saved on it stays
visible as Not sent and is never sent, and an id that names no open
question of the thread refuses the whole send with invalid_supersedes,
listing the thread's open questions. The window draws the Quiet card
(Replaced / No longer applies), the newer card's Replaces line, the reply
notice and the stale guard at Send. Store stays append-only.
- Replaces: is read only when every token is id-shaped (a message id,
  optionally /key, or a bare key; one trailing period dropped), so prose
  such as "Replaces: q-learning with PPO" stays prose.
- A pick or decision switch that meets 422 question_superseded sets no
  error; the thread is read again and the card redraws as Replaced.
- Two blocks naming the same old question refuse the send.
- The relay pushes for any message that superseded a question (question
  null for a withdrawal) so it collapses over the stale notification, and
  only ever offers an open question.
- inbox --help: a replayed key with another supersedes is refused.
@backnotprop
backnotprop merged commit 77aeaaa into main Oct 11, 2026
32 checks passed
@backnotprop
backnotprop deleted the feat/inbox-replaced-questions branch October 11, 2026 04:33
backnotprop added a commit that referenced this pull request Oct 11, 2026
… 'changed' line) (#1851)

* Inbox: a quiet project in the sidebar no longer draws as a question card

* Inbox: the replaced-question notice no longer restyles the attachment pane's changed line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant