Skip to content

feat(items): show waiting questions as cards on the item page - #44262

Merged
AmethystLiang merged 7 commits into
mainfrom
AmethystLiang/item-ask-question-card-upstream-codex
Nov 19, 2026
Merged

AmethystLiang merged 7 commits into
mainfrom
AmethystLiang/item-ask-question-card-upstream-codex

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What changed

The item page places an open question directly after Activity, using the same question card as chat. An amber outline and Waiting on you label distinguish it from earlier entries. Choices, multiple steps, free text, long-body expansion, and a compact-window scroll cap keep the question and answer together. Closing the card restores the comment box; completed questions show a quiet answer receipt.

Answers are recorded atomically with the item transition and notification, support idempotent retries, and reject incomplete or closed questions. A recorded answer names its question with the same answers link that a plain reply now carries, adds its picks as decisions, and its move to In progress carries cause: 'answer', so reply quotes, Answered links, and the hidden answer move treat both kinds alike. A question answered by a plain reply shows "Answered in a comment", which jumps to that reply. Session drafts preserve picks and text across question changes and uncertain replies. On a host that predates recorded answers, the page says the host can't record answers yet and keeps the words to copy; nothing is sent in their place. Question history handles snooze events in one linear pass. The phone shows recorded-answer receipts and removes the redundant Answering strip.

Why

Keeping the question and answer together makes the required action easier to find and avoids a detached answer field. Explicit answer records distinguish a submitted decision from an ordinary comment.

Evidence

  • Rebased onto current main, which separately added reply-to-question links, comment request ids, reply quotes, and pending comments in the same files. The rebase keeps those features and moves the PR's recorded answers onto the same question link.
  • Review follow-ups: the card appears once a remote host reports answer support; an answer still being sent is never sent twice; answer mail no longer holds the reply; mixed answer-and-comment requests and an empty --ask are refused; prose questions stay whole on their answers and are quoted on the phone; a reply's jump lands on the question card; digits that name no choice reach the comment box; a hidden draft takes no dropped files; the current step is marked for screen readers; on a host that predates recorded answers, nothing is written in the answer's place: no automatic comment and no Send again. That host takes a comment on a waiting item as the answer to whichever question is open when it lands, and its comment write cannot name a question, so no client-side check could keep such a comment on the question it answers. Tests cover a replacement question arriving while the answer is out, a replacement between any read of the first question and the point a write would go (the test checks the replacement ran), and retries; in each, only the refused answer calls reach the host.
  • UX follow-ups: the open card (and the comment box) rises clear of the floating workspace button from its first layout, not only after a window resize; a linked Activity row shows the URL or path without its url:/file: kind and wraps after path slashes rather than mid-word; on the item page, a several-step question's step tabs and count sit inside the card.
  • Local: changed-file lint pool, web/node/CLI/mobile typechecks (including mobile tests), 2,006 desktop tests across the bot, item, CLI, and chat prompt suites, and 116 mobile bot tests passed.
  • Stored answers have one format. The earlier draft format (an answersEvent field with an answers array) existed only on this PR's branch before the rebase reworked it (commit 7490fd6, never merged): git grep answersEvent and git log -S answersEvent find nothing on main (6ccd4ec), and none of the 118 release/rc branches or 711 v1.4 tags (through v1.4.264) contains that commit or any commit adding the field. No build from main or any release wrote that format; only a profile that ran this unmerged branch before the rework could hold it. Supported population: released builds and main. Profiles built from this unmerged branch are development-only and unsupported, so this PR adds no compatibility handling for that format.
  • Screenshots to follow.

Performance

Question history uses one backward pass rather than copying the remaining history for each question. The answer-move check reads the previous event instead of rescanning earlier events, and every answer first looks for an earlier write of the same answer id with one query on the (item_uid, id) index that starts after its question (a query-plan test checks item_uid=? AND id>?). That skips the item's earlier events, but it has no upper bound: LIMIT 1 stops at a match, not at a row count, so with no match it checks every later event of that item, and its cost is linear in them. It runs before the question-closed check, inside the answer's BEGIN IMMEDIATE write transaction, in the bots DB worker that runs this host's item-store calls one at a time, so while it runs, other item writes and reads on that host wait (off the runtime's main thread).

Three cases:

  • First answer to the open question: the later events are only the item's activity since the question was asked.
  • Retry of a recorded answer: the query can return once it reaches that answer, but with no ORDER BY it has no guaranteed traversal order, so its cost is not assumed to be lower than the stale case.
  • Stale answer with an unmatched id, for example from a card left open on another device after the question was replaced or answered: it reads every event of the item after that old question, then the host refuses it as closed. Each stale request comes from one owner action; nothing resends on its own, and a resend after a lost reply reuses its answer id.

This rests on an assumption, not on anything enforced: items hold small histories. Each bot or owner action appends one or more events (an owner comment on a waiting item adds the comment and a status move, and can also end a snooze; links, edits and snoozes add their own), so we expect hundreds to low thousands of events per item, but nothing caps or trims an item's history. A synthetic in-memory SQLite probe during review measured roughly linear work, about 8–9 ms at 100,000 later events. That figure is illustrative only, not evidence of a worst-case wait: real service time also depends on event payload sizes, disk and page cache, CPU load, and other requests queued behind it in the worker. No regression or incident was measured. The judgment is conditional: the residual cost is acceptable while item histories stay small. If items with long histories appear, revisit with an answer-id index (or by recording the answering event on the item row). The card reuses chat components and adds no polling loop. Keeping a box clear of the floating button costs, per mounted box, two ResizeObservers (one on the box, one on the other boxes in its column) and one MutationObserver on the column's child list. A child-list change re-watches the column's direct children, a handful of elements. The open card and the comment box each use it, and both stay mounted while one is hidden (a folded card, or the comment box behind the open card), so an item page usually has two: four ResizeObservers and two MutationObservers. Each change costs a few bounding-box reads, everything is disconnected on unmount, and no observer regression was measured. The PR's diff against its merge base holds only this feature's files; main's own changes taken in by the rebase are not part of it. The synthetic fixtures are development-only and add no production runtime work or CI jobs.

Follow-ups

  • Attachments on recorded answers; attachments currently go with comments.
  • The interactive question card on the phone.
  • Translated copy for answer validation messages.
  • If items with very long histories appear: bound the stale-answer lookup with an answer-id index or a record of the answering event.
Files Added Deleted Net
Test 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1086 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1079
Prod 47 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2493 $\color{#cf222e}{\Huge{\mathbf{−}}}$​303 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2190

coderabbitai[bot]

This comment was marked as off-topic.

coderabbitai[bot]

This comment was marked as off-topic.

coderabbitai[bot]

This comment was marked as off-topic.

@AmethystLiang
AmethystLiang force-pushed the AmethystLiang/item-ask-question-card-upstream-codex branch from f9474dc to c506677 Compare November 19, 2026 12:44
coderabbitai[bot]

This comment was marked as off-topic.

@AmethystLiang
AmethystLiang force-pushed the AmethystLiang/item-ask-question-card-upstream-codex branch from c506677 to b52b243 Compare November 19, 2026 13:08
coderabbitai[bot]

This comment was marked as off-topic.

@AmethystLiang
AmethystLiang force-pushed the AmethystLiang/item-ask-question-card-upstream-codex branch from b52b243 to 51f0f2f Compare November 19, 2026 13:25
key={question.eventId}
prompt={prompt}
draft={draft}
isSubmitting={submitting}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving as is for this PR. After a fallback, the draft notice above the card states the answer was sent as a comment and offers Send again as the retry; the card's own Submit is a no-op in that state. Folding that state into the card's button is a follow-up.

const answers = botItemAnswersOf(selections)
const problem = botItemAnswerProblem(ask, answers)
if (problem) {
toast.error(problem)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving as is for this PR. The card checks the same limits before submit, and these messages come from the shared validator the host also uses. Moving it to reason codes with translated renderer copy is a follow-up.

@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
coderabbitai[bot]

This comment was marked as off-topic.

- Show the answer card once a remote host reports answer support, not only after an unrelated re-render.
- Never post an answer as a comment twice after an older host took it once.
- Send an answer's mail without holding the reply, as comments do.
- Refuse an answer that also carries text or images, and an --ask with no question.
- Keep a prose question whole on its answer, and quote it on the phone when the question is off the page.
- Land a reply's jump on the question card, not its context comment.
- Let digits that name no choice reach the comment box, and take no file drops into a hidden draft.
- Mark the current step for screen readers.
…tion is open

An older host takes a comment on a waiting item as the answer to whichever
question is open. Read the item right before the fallback comment, and on
Send again, and post only while the answered question is still the open one;
otherwise nothing goes and the answer stays kept on the page.
@AmethystLiang
AmethystLiang force-pushed the AmethystLiang/item-ask-question-card-upstream-codex branch from e05b38c to 66c04e6 Compare November 19, 2026 14:27

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9ac078bb-2706-4213-8525-1f5e2e26a9f9
Commits

Reviewing files that changed from the base of the PR and between e05b38c and 66c04e6.

Files selected for processing: 2

  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
Files skipped from review as they are similar to previous changes: 1

  • src/renderer/src/i18n/locales/en.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
…its Activity

- Lift the open card or comment box clear of the floating workspace button from the first
  layout: the box moves when Activity above it fills in, without resizing, so its column is
  watched too.
- Show a linked event's refs as the URL or path itself, without the url:/file: kind, and
  offer line breaks after path slashes and before a query, not mid-word.
- Put a several-step question's step tabs and count inside the card's bordered body on the
  item page; chat keeps its own layout.
coderabbitai[bot]

This comment was marked as off-topic.

@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
…cord

An older host refuses a recorded answer and writes nothing. The page no longer posts a plain
comment in its place, on its own or from Send again: that host takes a comment on a waiting item
as the answer to whichever question is open when it lands, which may be a replacement. The page
now says the host can't record answers yet and keeps the words to copy.

A retried answer's lookup now reads only the item's events after its question, through the
(item_uid, id) index.
coderabbitai[bot]

This comment was marked as off-topic.

@stablyai stablyai deleted a comment from coderabbitai Bot Nov 19, 2026
The test's replacement only ran from a read the page no longer makes. It now runs right after
any read of the first question, or right after the refusal is handled when nothing reads, and the
test checks that it ran before asserting nothing was written.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The change adds structured questions to bot items and lets owners submit recorded answers. The CLI and RPC contracts carry ask and answer data, while storage validates answers, records answer events, and moves answered items to In progress. Activity and mail distinguish recorded answers from ordinary comments. Desktop and mobile interfaces display questions and answers, support answer drafts, and show recovery notices for unresolved submissions.

Merge Risk: Low · up to 8a9e9

The feature adds answer cards for waiting questions. Several minor edge-case and polish issues from earlier review remain open, including draft handling, messaging, and mobile display. None is likely to cause serious failures, but the owner should be aware of them before merge.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The PR description is thorough and covers what changed, why, evidence, performance, and follow-ups, but it does not follow the repository template. It lacks the ELI5 section, the Linked Issue section … Add the missing template sections: an ELI5 summary; a Linked Issue with an actual 'Fixes #' reference (required for outside contributors); Visual Proof with before and after screenshots or videos for the UI changes (the description c…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title "feat(items): show waiting questions as cards on the item page" matches the main change. The PR adds an open-question card after Activity on the item page, reusing the chat question card, an…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(items): show waiting questions as cards on the item page" matches the main change. The PR adds an open-question card after Activity on the item page, reusing the chat question card, and the summaries confirm the card, the answer recording, and the removal of the old Answering strip. The title is specific and conventional, and it does not describe anything absent from the changeset.

Full details: Description check

Explanation

The PR description is thorough and covers what changed, why, evidence, performance, and follow-ups, but it does not follow the repository template. It lacks the ELI5 section, the Linked Issue section (the description has no 'Fixes #' issue link), the Visual Proof section (no before/after; it says 'Screenshots to follow'), the Testing checkboxes, the Risk section with a level and rollback plan, the AI Disclosure, the Review and Agent skill upstream boundary sections, and the Checklist. The UI changes have no visual proof attached. The description is largely aligned with the intent but missing several required template sections, so the check fails.

Resolution

Add the missing template sections: an ELI5 summary; a Linked Issue with an actual 'Fixes #<issue>' reference (required for outside contributors); Visual Proof with before and after screenshots or videos for the UI changes (the description currently says 'Screenshots to follow'); Testing with the checklist items marked and the platforms actually tested; a Risk section with a Level (Low, Medium, or High), the breaking-change surface (for example older hosts and the saved answer format), and the rollback approach; the AI Disclosure section if applicable; the Agent skill upstream boundary checkbox; and the PR checklist.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 36783de8-06ff-4d52-9d67-36950361faa9
Commits

Reviewing files that changed from the base of the PR and between 000eb96 and 8a9e9ce.

Files selected for processing: 1

  • src/renderer/src/components/bots/items/BotItemView.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@AmethystLiang
AmethystLiang merged commit cd9ed74 into main Nov 19, 2026
56 checks passed
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