Repository navigation
feat(chat): page a reply's pictures in the preview; fix(markdown): read closed choice tags as cards - #1685
Merged
Conversation
A reply that draws several pictures opened each one on its own: the lightbox showed that one image and stepping to the next meant closing it and finding the other. The preview now knows the pictures of the reply it was opened from, so both ends can walk the set. Desktop: `MessageBlock` gives every assistant turn one gallery, shared by all of that turn's text and tool segments (a nested `MarkdownContent` inherits it instead of starting its own), and the lightbox pages it with the arrow buttons, ArrowLeft/ArrowRight, and a horizontal trackpad swipe. Mobile: `TimelineCard` gives the turn the same kind of gallery, and the full-screen viewer pages it with the two side buttons and a one-finger horizontal drag at fit zoom; the drag follows the finger and only commits past `PAGE_SWIPE_MIN`, so a wobble still springs back. Both ends wrap, so the first picture's "previous" is the last one rather than a dead end. A counter (`1 / 2`) and a single-picture reply keeps its buttons hidden. `RemoteConversationView` draws its transcript with the same `MessageBlock`, so a remote conversation's pictures page exactly like a local one's.
A model wrote the card as `<futureos-choice>` … `</futureos-choice>` instead of the fence (two consecutive replies, `future/deepseek-flash`, 2026-11-24, while quoting the fence form correctly in their own prose). CommonMark kept the tags as text and joined the `option:` lines into one paragraph, so the reader got the card's source and the conversation was never flagged as waiting on an answer. The pair is now normalized into the fence it stands for and then goes through `parseChoiceCard` — one parser, one set of field rules, no second reader. It counts only when both tags are present and outside any other fence (a quoted pair is an example, not an attempt), and the bare fence line a writer leaves after the closing tag is dropped with it, so the card stays the reply's last block instead of rendering read-only behind an empty code block. The agent's badge reads the same shape (`normalize_choice_tags`), and a reply that spells `futureos-choice` and yields no card now logs a greppable warning (`choice card syntax without a card`) once per run — tolerance for one spelling must not swallow the next. Tests use the real failing reply verbatim (`choiceTagBlocks.test.ts`), the tag form and the fence form are asserted to give the same answer, and half a pair, the bare word and a quoted pair are all asserted to draw nothing. The prompt (`agent/src/prompt/choice.md`) is unchanged: the fence is still the one spelling it teaches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two chat improvements that landed on
dev-huichentogether: the markdown reader now understands a choice card written as a closed<futureos-choice>tag pair instead of the fenced form, and the desktop and mobile image previews page through all the pictures of the reply they were opened from.Commits
fix(markdown): read a closed<futureos-choice>tag pair as its card — the pair is normalized into the fence it stands for and parsed by the single choice-card parser, so a model that writes tags instead of a fence still produces a card the conversation can answer rather than raw source.feat(chat): page through a reply's pictures in the image preview — desktop lightbox (arrow buttons, ArrowLeft/ArrowRight, trackpad swipe) and mobile full-screen viewer (side buttons, one-finger horizontal drag at fit zoom), both wrapping around, with a1 / 2counter and hidden buttons for a single picture.Verification
Local, pinned toolchain 1.99.1,
ulimit -n 8192:cargo fmt --all -- --check-> passcargo check -p future-agent --all-targets-> passcargo clippy -p future-agent --all-targets -- -D warnings-> passcargo test -p future-agent --lib-> 3139 passed, 0 failed, 7 ignored (second run at the same SHA). The first run had one failure inprompt::tests::skill_locations_are_relative_to_their_named_scope, a pre-existing cross-testHOMErace:TestHomerewritesHOME/FUTURE_HOMEprocess-wide under a lock while that test reads the skill roots twice without taking it. It passes alone, the whole suite passes on rerun at the same SHA, and this branch touches neither that code nor that test.npx tsc --noEmitpass,npx eslinton the five changed files pass,npx vitest run src/features/markdown/imageGallery.test.tsx-> 5 passednpx vitest run --config ../packages/markdown/vitest.config.ts-> 35 files / 789 tests passednpx tsc --noEmitpass,npx jest --runInBandon the four changed suites -> 4 suites / 52 tests passedUser-visible changes
1 / 2counter is shown, and a single-picture reply keeps its buttons hidden. Rollback:cef11e863.<futureos-choice>...</futureos-choice>tag pair was shown as source text (the tags stayed text and theoption:lines were joined into one paragraph) and the conversation was not treated as waiting on an answer; after, the pair is read as the card it stands for, the agent's badge reads the same shape, and a reply that spellsfutureos-choicewithout producing a card logs a once-per-run warning. Rollback:1c1a53a69.No defaults, timeouts, permissions, migrations or feature-flag states are touched.