Skip to content

Inbox: decision mode (experimental) - #2141

Merged
backnotprop merged 7 commits into
mainfrom
feat/inbox-decision-mode
Oct 24, 2026
Merged

backnotprop merged 7 commits into
mainfrom
feat/inbox-decision-mode

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Builds decision mode for the Plannotator Inbox as an experimental feature, off by default. The approval record is .product/approved/inbox-decision-mode/ (approval.md, BRIEF.md §7 and §10, prototype.html ?direction=queue). That folder is not in this repo.

What it does

  • Gate. Settings → General → Experimental → "Decision mode". It is saved as config.json experimental: { decisionMode } through POST /api/inbox/settings { experimental: { decision_mode } }. PLANNOTATOR_EXPERIMENTAL=decision-mode turns it on and -decision-mode turns it off; while the env var decides, the switch is locked. resolveExperimental(config, name) lives in packages/shared/config.ts with a small name-to-key table. saveConfig merges experimental key by key, so switching one flag keeps the others. With the gate off, nothing of decision mode renders and GET /api/inbox/decisions answers 404. There is no telemetry.
  • One rule for "waits on the person". The new inboxQuestionWaitsOnPerson in core is read by summarizeInboxQuestions (so the list's sections), by threadOpenQuestions (the thread's popover) and by the projection. inboxUrgencyOf is shared between inboxSectionOf and the queue's order. A fast-check property test runs histories of sends, picks, replies, Mark read, archive, supersede, Re-ask and action marks. After every step it asserts that the Decide count equals the list's count (open + picked of the rows in Stopped, Holding and Waiting, plus "Answered, not sent"), and that each thread's decisions equal its popover's questions.
  • GET /api/inbox/decisions. A read-only projection (store.openDecisions()) with no new records. Each item has the question as the thread route serves it (revision included), a message excerpt, picture and attachment refs, the thread, and the session. The order is brief §7's: each session's decisions together, a thread at a time, the most blocked session first, Stopped first. The route has the window guards (another site is refused) and is served to the owner over the tailnet like other read routes. The event stream keeps it live.
  • The Queue dialog. It shows one decision at a time with the next card peeking behind it, and a strip of one chip per agent session. The card has the question, its context and the message's pictures (the first one leads and opens in the existing image viewer). Below it are Open the thread (which tucks the dialog into a "Decisions · N left · Resume" pill), Previous, Undo, Later (client-only), Skip, Other and Add a note. Picks go through the existing picks route. Once a session's decisions in a thread are handled, its chip says "Sending in 5 s · Hold". The reply then goes through the existing reply route via sendTargetsOf: one reply per agent session per thread, with the skip and supersede rules unchanged. Afterwards the chip moves through Queued/Saved, Delivered, Working and Replied. Closing with a session half answered asks "Send what you answered / Keep as a draft". A question replaced while it is on screen swaps in under a banner.
  • Ways in. "Decide N" in the sidebar and in the list header, both shown only when 2 or more decisions are open. A Stopped notification opens decision mode on that card.
  • Interaction. Swipe works on touch only, for two-way choices, and both choices always stay as buttons. There is no bulk accept and there are no new keyboard shortcuts. Reduced motion, light and dark, phones (full screen, 44 px targets), the Soft look and component tooltips (no native title) are all covered.
  • The agent contract lines (Stakes, Shows, Why, Reversible, picture choices) are not approved, so only today's grammar is drawn. cardFacts in DecisionCard.tsx is where they will be read, and the card already has a place for each.

Choices where the brief left room

  • Action items are in the queue (brief §10). They show Open/Copy, Done and Can't do it through the existing actions route, which keeps its own 10 s Undo and sends the report itself. So a session group that holds only action items sends no reply.
  • No device-door row. On the door, decisions is still the removed Decisions route, and an existing test pins it as refused. An older phone app might call it expecting the old records, so I left the door alone. A row can be added later under another name.
  • A picked-but-not-sent question counts as handled. A later sitting starts after it, and Previous still reaches it. Words, files and comments waiting in a thread are left for that thread's own Send; decision mode's reply carries answers only.
  • The read-only "All" overview is in the head (approval §7, from direction C), with no bulk accept.
  • Drawing on pictures is not in this PR. The brief's "Keep with my answer" pen is not built; pictures open in the existing lightbox.

Tests

  • packages/shared/inbox/store-decisions.test.ts: order, the drop-outs, the property test.
  • packages/server/inbox-decisions.test.ts: the gate, the env override both ways, Settings keeping other experimental keys, guards, order, picks and Send through the existing routes, the door refusing the route.
  • packages/shared/config.test.ts: experimental features.
  • packages/inbox/decisionsModel.test.ts: the pure queue.
  • DOM test packages/inbox/decisionMode.test.tsx, added to test.yml's DOM list: the gate off, walking the queue, a pick saving, the per-agent Send after Hold, Undo and Previous, Later, a replaced question, close with Keep as a draft, Open the thread and Resume.
  • e2e tests/e2e/inbox-decision-mode.spec.ts on the compiled binary: Chromium desktop and WebKit iPhone 15, light and dark. The agent's own wait_for_reply receives the one reply with both answers.

backnotprop and others added 6 commits October 24, 2026 15:45
- A Hold starts only for a group the person touched in this sitting; a group
  ready before it (Keep as a draft) waits as Held · Send, and a thread with a
  reply draft never sends from here (checked again right before a send).
- A follow-up answered after a group's reply goes round again; each send
  records what it carried and renews its key when the answers change.
- Holds pause while decision mode is tucked; a pick restarts the 5 s; the
  countdown never shows more than 5 (it read 10 s for a frame).
- The close question names what is left (half answered, waiting to send,
  failed, a draft reply, typed words); a failed Send never closes.
- An action item's Undo only inside its window, reopened only once the
  server confirms; refusals shown. Only question_superseded is quiet.
- Escape in a box with words lets go of it first; Previous draws a sent card
  read only; a committed swipe keeps moving from where the finger left it.
- Notifications pass their question id and move an open sitting to it;
  focus returns to the Decide button; the pill clears the thread's foot.
- The list counts unknown question kinds again (inboxQuestionWaitsForList,
  differential test against the pre-PR summarize); the notifier uses it.
- A waiting Re-ask note leaves out what it lists, per note; the projection's
  model test follows.
- saveConfig merges experimental only as a plain object; the settings POST
  answers 409 experimental_env_decides while PLANNOTATOR_EXPERIMENTAL decides.

Co-Authored-By: Claude <[email protected]>
# Conflicts:
#	packages/inbox/App.tsx
#	packages/inbox/components/Sidebar.tsx
#	tests/e2e/playwright.config.ts
- H1: a Hold waits behind the close question (and while one of its cards is
  being edited, and while tucked); the close question reads its reasons live;
  Keep as a draft waits for a reply on its way and says if it failed.
- H2: a group's cards are read only while its reply is on its way, and its
  picks go with unsent_only, which the picks route refuses with
  question_already_sent once the question was sent (opt-in: the thread-state
  model keeps a sent question re-pickable for every other caller). A reply
  key is renewed when an answer's revision changed.
- Touches are counted per decision, and Undo takes one off: a Hold whose only
  touched answer is undone gives way to Held · Send.
- The draft state follows the latest row or a fresh read made since it;
  comments waiting count as a draft; a draft read that fails sends nothing;
  leaving the draft state keeps a Hold the person pressed.
- A reply still sending is a close reason; a failure is never silent.
- A failed group with nothing left to send is waiting; a session that ended
  mid-Hold says the reply waits for the next agent; a notification never
  drops typed words (a banner, and words are kept per card); a replacement on
  its way counts as left; an action item's Done is a pending pick, and its
  Undo clears gone.
- The stamp's timer and a projection read never move the queue off a card
  the person went to on purpose.
- Re-ask exclusion: per note as list rule 2a reads it, and only while the
  session it went to is still there.

Co-Authored-By: Claude <[email protected]>
@backnotprop
backnotprop merged commit 47cd5ce into main Oct 24, 2026
32 checks passed
backnotprop added a commit that referenced this pull request Oct 25, 2026
…-lines

Decision mode: the agent contract lines on the Queue card, and #2141's review follow-ups
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