Skip to content

feat(dashboard): waiting-on-you cards pin an agent's ask above the composer - #39362

Closed
unstablebrainiac wants to merge 1 commit into
kirodotdev:mainfrom
unstablebrainiac:feat/waiting-on-you-cards
Closed

unstablebrainiac wants to merge 1 commit into
kirodotdev:mainfrom
unstablebrainiac:feat/waiting-on-you-cards

Conversation

@unstablebrainiac

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An agent can pin what it needs from the person above the composer, as an "Action for you" card that stays until the person answers it or writes, the agent clears it, or it expires.

When an agent is blocked on the person, only the turn that first said so explains the ask. In a watch loop every later cycle adds another "still waiting on you" reply on top, so the person scrolls back to find what is needed. [OPTIONS:] chips come only from the newest reply. The ask_question card blocks the turn for 30 minutes, then is withdrawn. Nothing keeps an ask in view across turns.

Why it matters

Loops that wait on a person for hours produce one reply per cycle that says nothing new, and the actual ask scrolls out of view. Non-loop chats lose the ask too, as soon as the person asks a side question. The sidebar cannot say "waiting on you" for a plain-text ask (#20961).

Not a goal

  • Phase 2 of the design: prompt, babysit and goal-conductor guidance that would tell a loop to stop restating its ask. That changes default loop behaviour and waits for the RFC to be accepted. The tool description stays neutral on it.
  • Changing ask_question, native question cards, [OPTIONS:] chips or needs_input.
  • Channel surfaces (Slack, Discord, Webex): the tool tells those sessions to use [OPTIONS:].

What changed (motivation → approach → change)

An agent can now pin what it needs from you, an action or a decision with options, as an "Action for you" card above the message box. The card stays across turns, loop cycles and restarts until you answer it or write in the chat, the agent clears it, or 7 days pass, so the ask no longer scrolls away. This is Phase 1 of the design in PR #39294 (docs/request-for-change/rfc-waiting-on-you-cards.md, still draft); the packaged doc is src/kiro_crew/docs/waiting-on-you.md.

Part What it does Where
Agent tools waiting_on_you pins or replaces one ask: a key, a title, optional detail, and 0 to 6 options. waiting_on_you_clear removes it. Up to 4 per session. Over-length text is refused, never cut. mcp_tools/control_parts/waiting.py and schemas.py, validation_parts/server_registries.py, mcp_core_parts/identity.py, data/mcp_tool_titles.json, mcp_listing_relay.py, shared limits in waiting_on_you_contract.py
Store waiting_on_you.json under the data home, MAC'd like change_cards.json. It survives restarts and lazy tab restore. Incognito sessions keep asks in memory only. dashboard/waiting_on_you.py
Retirement A live owner message (meta.human, owner as author) retires every ask. Auto-nudges, crons, sub-agents, peer session_send, apps and teammates retire none. Answering a card retires only that card. Fork starts empty; rewind and edit-and-resend clear. dashboard/waiting_on_you_events.py, dashboard/state_parts/slot_transcript.py
Answers Owner-only routes check the current ask_id and the stored options, and are idempotent per answer_id. Only the chosen label or typed text becomes the user row, so agent-written text never arrives with the owner's authority. A gateway restart mid-answer leaves the card marked "may already have been sent", never re-sent. dashboard/handlers/waiting_on_you.py (a registered redaction sink in security_posture_sinks_gateway.py)
Agent context A gateway-written [WAITING ON YOU] block lists pinned asks, names retired ones once with their full text, and says which ask a card answer answers. It is capped at 6,000 characters. context_blocks.py, dashboard/chat_turn/
Dashboard The card sits under the question card in both composers: options as one list with a Send button, Done on an action card, ✕. Sidebar rows, the tab strip and grid panes show "Action for you · title" in --aim, separate from "Waiting on you". The needs-me hover card and the Questions tab list asks too. Strings ship in all 12 locales. website/src/components/waitingOnYou/, website/src/api/client/approvals.ts, website/src/types/, website/src/i18n/

Where this build differs from the draft RFC: a paused crew queues the answer instead of refusing it (that is how chat send behaves), edit-and-resend clears asks like rewind, and Shared Crew teammates get 403 on the answer and dismiss routes. The RFC will be updated to match.

PR Size (shadow, not enforced) reports 93 files over its 80: backend, frontend, 13 locale catalogs, tests and 6 screenshots. The two halves share one contract and land together.

Backwards compatibility

Compatible: the tools, store, routes, slot field and context block are all new. Agents that never call the tools see no change. An older build ignores waiting_on_you.json and the waiting_on_you slot field, and skips the unknown waiting card surface.

Removes nothing: no existing key, route, field, row, validator or capability is taken away; needs_input and every reader of it are unchanged.

Tests

  • test/test_waiting_on_you_store.py: survival across restart and lazy restore, tamper-evident records, an oversized file left alone, a failed write that broadcasts nothing and keeps every slot, expiry, incognito.
  • test/test_waiting_on_you_retirement.py: only a live owner row retires; replays, nudges, crons, peers, apps, Issue Radar and teammates do not; fork, rewind and delete; restored asks are pushed after load.
  • test/test_waiting_on_you_answers.py: exact label sent with its meta; old ask_id, label not among the options, a second window, retries and concurrent answers; a refused send keeps the ask; a send refused after its row landed becomes uncertain; queued answers never merge.
  • test/test_waiting_on_you_agent.py: tool and gateway refusals with SEL audit; the per-turn block's cap, boundary escaping and answered line, including no answered line on a machine-opened turn; no loop guidance in the tool, the doc or the block.
  • Frontend: WaitingOnYouStack.test.tsx, waitingOnYou.test.ts, NeedsMeHoverCard.waiting.test.tsx and commandCenterPanel.waitingOnYou.test.tsx cover render, answer, every 409, retry reuse, dismiss, the kept draft, the stale answer returned to its own session's draft, status precedence and the selectable list.
  • Guard updates: the request-size cap register, the MCP listing imports, the cache-reset floor and the security-posture sink list.

Each fix found in local review has a regression test that fails when the fix is reverted.

Manual verification

website/scripts/capture-waiting-on-you.mjs mounts the real ChatPage in a capture harness with intercepted API answers. It asserts each state, then writes the frames below in light and dark. All 102 checks pass. Each frame was also inspected by eye. That inspection found one defect: "Show more" appeared when nothing was hidden. It is fixed by measuring the clamp after layout.

Real-machine verification

Machine: Amazon Linux 2023 cloud desktop, x86_64, 192 vCPU / 740 GiB.
Before (main 6e059d769e): git grep -c WaitingOnYouStack -- website/src -> no matches; no card, tool or route exists.
After (head 47bb33c8af): node scripts/capture-waiting-on-you.mjs ../temp-screenshots/waiting-on-you -> exit 0, 102 checks pass, 18 frames written.
Cleanup: own machine; the capture server ran in-process on 127.0.0.1 and exited with the script.

Screenshots / video

A decision card, dark. Options form one list with a single Send:

Decision card, dark

A stack of three asks, collapsed to "+2 more", light:

Stack collapsed, light

More frames: action card, answered elsewhere, needs-me hover card, 390px

Action card with Done, dark

Answered elsewhere, light

Needs-me hover card listing the ask, dark

Decision card at 390px, light

Related Issues

Part of #20961

Checklist

  • A Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@github-actions github-actions Bot added the fork Pull request from a fork (external contributor) label Nov 19, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

UX-level review of 1791f6ffa0d96d0a518e352489a44d88bddb1af2 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

cannot evaluate: missing screenshots of most of the card's states and of three of the five places it appears. The six frames show only the resting decision card, the action card, "+2 more" collapsed, "Answered elsewhere", the sidebar row and the hover card.

Evidence gaps

  • Decision card with an option selected and Send enabled (aria-pressed selected style). Needs a frame after an option is clicked.
  • The expanded stack, with "Show fewer" and the older asks open. Needs a frame of 03-stack after clicking "+2 more".
  • The uncertain warning: "Your answer may already have been sent. Check the chat above."
  • The error states on the card: "Your answer did not reach the session. Try again.", "The session did not take the answer, so the ask stays pinned. …", "That answer is no longer one of the options.", "Could not dismiss this ask. Try again."
  • The "superseded" and "cleared" closed cards, each with "Your answer is in the composer. Nothing was sent."
  • The closed card for an unsent note, with its "Put in composer" and "Discard" buttons. These are the only new action buttons that no frame shows.
  • The read-only view for a non-owner: the options as a bullet list plus "Only the session owner can answer this."
  • The grid pane's header ActionForYouPill and the grid pane picker's --aim status dot.
  • The session tab strip's action status dot (TAB_STATUS_COLOR.action = var(--aim)) on a tab that has an ask.
  • The Questions tab in Command Center, with the per-session WaitingOnYouStack layout="list" under a session title, and its count including the asks.
  • A detail long enough to clamp, with its "Show more" / "Show less" toggle.

Notes

  • When I traced the code, it held one card's ✕ (variant="danger", "Dismiss this ask"), so dismissing seemed to remove only that card. No undo is shown. A frame of the card right after dismiss would settle whether the result is clear to the user.
  • status_action ("action for you · {{title}}") is the tab's accessible name. Check that the tab's visible dot doesn't use --aim purple as its only cue: the sidebar pairs that colour with the ✋ icon and the word, but the tab dot has nothing alongside it.

[UX-REVIEWED] 1791f6f

Description read

[DESCRIPTION-READ] 1a062ff5354319e4fd6b49fd8c88763d9581eb801660971c21e487f9d5b26f43

That sha256 names everything this verdict read: the PR description, plus the 9 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 1791f6ffa0d96d0a518e352489a44d88bddb1af2 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. Everything is additive (new tools, store, routes, slot field, context block), the six committed screenshots count as rendered evidence, and the take-away check found no reader that breaks.

Notes

  • This builds Phase 1 of an RFC that is still draft (PR docs(rfc): propose waiting-on-you cards that pin an agent's ask above the composer #39294), and it already departs from that RFC in three places (paused-crew queueing, edit-and-resend clearing, teammate 403). Get the RFC updated and accepted first, so the decision record doesn't trail the code it governs.
  • Retirement now hooks into every slot_transcript.append, so every row append runs it. Keep on_live_user_row an in-memory check that exits early on non-owner rows, because it sits on the hottest write path in chat.

[DESIGN-REVIEWED] 1791f6f

Description read

[DESCRIPTION-READ] 9d38ea58323aba4e5e64c4fa42c9645039d0836481be47bd72723f2deeb966ef

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 1791f6ffa0d96d0a518e352489a44d88bddb1af2 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. Each item answers the ask-scrolls-away harm from #20961, and the existing ask mechanisms do a different job: ask_question blocks the turn, chips come only from the newest reply, needs_input does not keep the ask in view.

What this change ships

Inventory (10 items) — 10 justified

Intent: let an agent keep what it needs from the person in view, above the composer, until it is answered or cleared. This is an ADDITION.

  1. Agents can pin an "Action for you" card above the composer (waiting_on_you) — justified
  2. Agents can remove a pinned card (waiting_on_you_clear) — justified
  3. Pinned cards survive restarts and lazy restore, and expire after 7 days — justified
  4. Any live message the owner writes retires every pinned card; automation retires none — justified
  5. The owner can answer or dismiss a card; the chosen label becomes their message — justified
  6. The agent's turn carries a [WAITING ON YOU] block listing its pinned asks — justified
  7. Sidebar rows, the tab strip and grid panes show "Action for you · title" — justified
  8. The needs-me hover card and the Questions tab list the asks — justified
  9. The conversation history records "Pinned / answered / cleared: title" rows — justified
  10. A screenshot capture harness and 6 committed frames — justified

[FIRST-PRINCIPLES-REVIEWED] 1791f6f

Description read

[DESCRIPTION-READ] 965698c390785d89c464c3289fee7d743d5accacec97e4b7fbfafa41593a92fd

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@unstablebrainiac
unstablebrainiac force-pushed the feat/waiting-on-you-cards branch from 47bb33c to 519eae8 Compare November 19, 2026 02:40
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — 🔴 changes requested (blocking)

Reviewed 1791f6ffa0d96d0a518e352489a44d88bddb1af2 via the fork AI-review pipeline; updated in place on each push.

Blocks merge: an option label the agent writes is sent as the owner's own chat turn with commands enabled. One selection plus Send on a /clear option runs /clear, the exact chain the follow-up-chip fence was added to refuse.

BLOCKING — src/kiro_crew/dashboard/handlers/waiting_on_you.py:584
body = {"slot": slot_key, "message": text, "meta": {"sendId": answer_id}} / return await chat_handlers.api_chat(inner)
Trigger: an agent steered by untrusted content (a fork PR diff, a web page) calls waiting_on_you with options: [{"label": "/clear"}, …]. validate_declaration only checks length and uniqueness, and _redacted leaves the label alone. The owner selects that option in WaitingOnYouCard and presses Send (onAnswer({ label: selectedLabel }), with no dispatchIsCommandShaped check). Then api_waiting_on_you_answer → _checker returns the label verbatim → _send → api_chat → _run_chat with _commands_off=False → slash_commands.py:544 sets first_word = "/clear" and the turn forwards it as a harness command.
Outcome: text the agent chose runs as a slash command authored by the owner, e.g. /clear erases the transcript. A label holding a $skill token or starting with @ would likewise load a skill or prompt. website/src/app-sdk/protocol/dispatchShape.ts documents this same agent-authored-label-to-one-click chain and refuses it for chips.
Anchor: residual/security
Fix: refuse command-shaped labels in validate_declaration (a leading / or @ after the dispatch trim, a $skill token, [ Paste #), or set COMMANDS_OFF_META_KEY on the answer's chat send (both the immediate and the queued meta).

[BLOCK-MERGE] 1791f6f
[OPUS-REVIEWED] 1791f6f

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — 🔴 changes requested (blocking)

Reviewed 1791f6ffa0d96d0a518e352489a44d88bddb1af2 via the fork AI-review pipeline; updated in place on each push.

1 of 4 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

BLOCKING -- website/src/pages/ChatPage.tsx:1273 -- Return rejected answers to their originating session

returnToComposer={insertDashboardReply}
Trigger: Answer a card in session A, then switch to B before a superseded or cleared response arrives; useWaitingOnYouActions invokes the captured callback, which writes into the current composer.
Outcome: A’s unsent answer enters B’s draft rather than A’s, contaminating the wrong conversation.
Anchor: defect
Fix: Capture the originating slot and return the text through restoreToComposer(slot, text).

BLOCKING -- src/kiro_crew/dashboard/waiting_on_you.py:521 -- Do not classify pending reservations as completed answers

raise AskError(409, CODE_ANSWERED, "this ask is being answered")
Trigger: Two windows answer the same action card while the first send awaits preparation; the second receives answered, but the first subsequently fails the typing-lease check and releases its reservation. Concurrent dismissal uses the same refusal.
Outcome: The second window deletes its unsent note and hides the still-pinned ask as “Answered elsewhere,” although neither answer was accepted.
Anchor: residual/crash-data-loss-corruption
Fix: Give pending reservations a distinct retryable refusal that preserves the card and draft.

BLOCKING -- src/kiro_crew/dashboard/waiting_on_you.py:341 -- Persist candidate records before exposing them to readers

self._slots[slot_key] = rec
Trigger: A declaration or removal awaits _persist() while a slot-list request or unrelated broadcast reads the store through SlotProjection; the write then fails.
Outcome: The dashboard receives an uncommitted addition or removal. Rollback restores the store without publishing a correction, leaving the displayed asks inconsistent.
Anchor: persist-before-you-publish
Fix: Mutate and persist a private candidate snapshot, then replace reader-visible records; use the same ordering for sweeps and evictions.

BLOCKING -- src/kiro_crew/dashboard/waiting_on_you_events.py:299 -- Preserve answer identification after retirement is consumed

if not slot_key or not store.has_any(slot_key):
Trigger: While a session is busy, queue an ordinary message before answering its only card. settle() retires the ask, and the earlier queued turn consumes that retirement before the answer turn starts.
Outcome: The answer turn receives no waiting-on-you block identifying its ask, despite its matching tombstone; a bare “Done” or shared option label loses its explicit association.
Anchor: defect
Fix: Resolve the current answer against tombstones even when no pinned or retired asks remain, and permit the renderer to emit an answer-only block.

[BLOCK-MERGE] 1791f6f
[GPT-REVIEWED] 1791f6f

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

I've ruled on all three findings and kept all of them blocking. The fenced finding (F2) also stays blocking.

F1 (website/src/pages/ChatPage.tsx:1273): Medium harm. The stack is keyed by session, but the answer callback is captured at click time (useWaitingOnYouActions.ts:5426, :5465). That callback is insertDashboardReply (composerHost.ts:85-88), and it writes into whichever composer is open when the refusal arrives. So session A's unsent answer is silently appended to session B's draft. The fix is cheap: restoreToComposer(slot, text) already exists and is used in useCommandCenter.ts:171 and AttentionCard.tsx:175.

F3 (src/kiro_crew/dashboard/waiting_on_you.py:341): Mutations are made in place on the record readers see, before the awaited _persist() (patch lines 1187-1216). slot_payload reads that memory with no lock (patch line 1618). The finding is tied to persist-before-you-publish, which is blocking: true in .review-base-rules/AUTOSDE.yaml:1218-1219, so I have no authority to downgrade it.

F4 (src/kiro_crew/dashboard/waiting_on_you_events.py:299): Low harm. The agent loses context about which ask an answer addresses; no data is lost. has_any ignores tombstones (patch lines 1242-1244), and the renderer returns empty when nothing is pinned or retired, even if answered is set (patch line 81). But the fix is about two lines, so its cost does not exceed the harm.

F2 (fenced): A concurrent answer gets answered while the first answer is still pending (patch line 1388). The client then deletes the draft and does not return the note to the composer (useWaitingOnYouActions.ts:5459-5464). The sequence needs two windows racing, but nothing in the code prevents it. I also did not trace the typing-lease release path in the handler, so the record a FLAG needs is incomplete.

[ADJUDICATION] 1791f6ffa0d96d0a518e352489a44d88bddb1af2 total=3 uphold=3 downgrade=0
UPHOLD F1 website/src/pages/ChatPage.tsx:1273 reason=harm-warrants-remedy
UPHOLD F3 src/kiro_crew/dashboard/waiting_on_you.py:341 reason=autosde-blocking-rule
UPHOLD F4 src/kiro_crew/dashboard/waiting_on_you_events.py:299 reason=harm-warrants-remedy
[GPT-ADJUDICATED] 1791f6ffa0d96d0a518e352489a44d88bddb1af2

[ADJUDICATION-FENCED] 1791f6ffa0d96d0a518e352489a44d88bddb1af2 fenced=1 flagged=0
UPHOLD-FENCED F2 src/kiro_crew/dashboard/waiting_on_you.py:521 -- Two windows answering one card while the first send is still preparing is a producible race, and the client then deletes the second window's typed note for good, so a human override cannot rest on rarity.
[GPT-ADJUDICATED-FENCED] 1791f6ffa0d96d0a518e352489a44d88bddb1af2

@unstablebrainiac
unstablebrainiac force-pushed the feat/waiting-on-you-cards branch from 519eae8 to 1791f6f Compare November 19, 2026 02:55
@unstablebrainiac

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/feature-map/README.md, src/kiro_crew/dashboard/file_api/dashboard_config.py, test/test_dashboard_files_coverage.py and the website/src/i18n/locales catalogs since this head's base (74e9123 -> f23c699); CI re-running. Related tests (test_dashboard_files_coverage, test_waiting_on_you_*), mypy, tsc, the feature-map check and the i18n suite pass locally on 1791f6f.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 19, 2026
@unstablebrainiac
unstablebrainiac force-pushed the feat/waiting-on-you-cards branch from 1791f6f to 19c1fa7 Compare November 19, 2026 21:01
@unstablebrainiac

unstablebrainiac commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in test/conftest.py, test/conftest_resets.py and website/src/i18n/en.context.json (all three conflicted; resolved as unions) since this head's base (f23c699 -> b8a2db9); CI re-running. This head also carries the UX Review blocker fix: an ask answered elsewhere, replaced or cleared now turns into its notice in place, with a regression test, and "composer" becomes "message box" in the UI text in all 12 locales. The capture script now covers the missing states; their frames and recordings are committed on #39616. Locally: isort, flake8, black, mypy, docs lint, 301 related backend tests, tsc, eslint, and 1,317 frontend and i18n tests pass.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 19, 2026
@unstablebrainiac

Copy link
Copy Markdown
Contributor Author

Superseded by #39616: the same commit on a kirodotdev branch, so Sensitive Change Review can pass.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant