Skip to content

feat(artifacts): one-click quick edits on a document artifact - #37765

Open
javenciu wants to merge 1 commit into
mainfrom
feat/artifact-edit-shortcuts
Open

javenciu wants to merge 1 commit into
mainfrom
feat/artifact-edit-shortcuts

Conversation

@javenciu

@javenciu javenciu commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: on a document artifact (markdown, plain text or HTML), one click asks the agent for the common rewrites: shorter, longer, simpler wording, proofread, and a more formal or more casual tone, for the text the reader selected or, with no selection, the whole document.

Today a reader who wants a paragraph tightened opens the companion chat and types the instruction by hand each time, naming the passage and the artifact. The page already knows the artifact, can read the selection in the rendered body, and has a bound companion session whose agent keeps versions through its own artifact update.

Why it matters

Rewrite requests are the most repeated thing readers ask an artifact's agent. A fixed menu removes the typing and the vague instruction ("make it better"), and every result lands as a new version the reader can revert.

Not a goal

  • No new route, model call path or direct write to the artifact: the agent applies the change through its normal artifact update.
  • No setting: nothing is sent until an item is picked.
  • No free-text prompt editor, and no shortcuts on widgets, apps, images, JSON or SVG.

What changed

  • website/src/components/artifactEditShortcuts.prompt.ts: the preset instructions, which kinds offer them, and the selection rule (the passage goes in as a JSON string; a blank or over 4,000-character selection falls back to the whole document). editQuotePreview cuts the passage to one line of 60 characters at a word (string methods, no regular expression).
  • website/src/pages/ArtifactDetailPageHeader.tsx: a Quick edits submenu in the More menu. Its label says who acts, quotes the passage and says how to go back: Agent rewrites “We ship on Tuesday, after the team has finished running…” · saved as a new version, or Agent rewrites the whole document · saved as a new version you can revert. While the menu is open, the quoted passage of a markdown or text body is painted with the existing annotate highlight (an HTML body renders in an iframe, so the quote is the cue there).
  • website/src/pages/useArtifactDetailPageCompanion.ts: sendEditShortcut follows the top bar's Request a Feature. The instruction goes to the bound session as background context (api.chatSlotContext(slot, text, { source: 'artifact-quick-edit', maxAge: 60 })), then the visible turn is one short catalog line such as "Shorter · selected passage". A refused context write sends nothing and shows its reason. A busy session (a turn running or sub-agents active) is refused before anything is written, because the drain hands context to the next turn that starts. slotBusy in busySend.tsx is the busy read slotBusySteer already took, now shared. resolveBoundSlot is the one cold-load lookup; a failed lookup sends nothing, and a session is created only after a lookup that found none.
  • website/src/pages/ArtifactQuickEditStatus.tsx: one role="status" line in the notice area: working, then "Shorter: saved as v4. To undo, pick the earlier version under Version and press Revert." when the live version rises, or "finished without saving a new version" when the turn ends with none. It is read from the artifact record and the session's turn count, with no polling or timer. Dismiss, a new quick edit or another artifact clears it.
  • useSelectionComposerAnchor.ts keeps the passage the selection box opened on; useArtifactDetailPageComments.ts asks before the chat panel replaces an unsent sidebar comment, and again after the lookup.
  • Catalogs: 17 strings in all 13 (7 new, 1 reworded); src/kiro_crew/docs/artifacts.md and the feature-map row describe the menu.

Backwards compatibility

Additive. The More menu gains one item on markdown, text and HTML artifacts viewed live. Other kinds and historical versions show the menu they showed before (pinned by tests that pass on main).

Tests

  • Round 3 (head 6c9a15f): the page's test file has 32 tests; 11 fail on the previous head (the short visible line and context order, the refused context write, the busy refusal, the three status-line tests, and five that now read the instruction from the context write) and all 32 pass. Whole website suite: 4,564 files and 71,289 tests in eight shards; the 9 that timed out under host load fail the same way on main or pass on rerun.
  • eslint, tsc -p tsconfig.app.json, i18n:check (RC=0), the language style suites with the base ref (12 files, 126 tests), the lane CI checks and the theme, class, string and restyle lints pass.
  • Reproduce: cd website && npx vitest run src/test/ArtifactDetailPage.editShortcuts.test.tsx
  • Proof: PROVEN website/src/test/ArtifactDetailPage.editShortcuts.test.tsx::ArtifactDetailPage edit shortcuts > shows a short line as the turn and hands the instruction over as background context first (head 6c9a15f)

Manual verification

Real page on loopback with a mocked gateway, markdown artifact, real mouse selection. The chat showed "Shorter · selected passage" and no instruction text; the context write carried source artifact-quick-edit and began "The user's next message is a Quick edit…". The harness then marked the agent's turn running and saved v4.

Chat after Shorter, with the working line:
Sent turn, light
Sent turn, dark
Working:
Working, light
Working, dark
Saved:
Saved, light
Saved, dark
Whole document:
Whole document, light
Whole document, dark
Selected text:
Selected text, light
Selected text, dark
Change tone:
Change tone, light
Change tone, dark

Sibling sweep

Sibling: website/src/pages/RemoteArtifactDetailPage.tsx -- not affected -- a remote listing has no companion session
Sibling: website/src/components/ArtifactSendToSession.tsx -- not affected -- it pre-fills a composer the reader sends

Pattern harvest

Rule candidate: review-prompt
Pattern: a one-click agent turn sends its instruction as background context and a short visible line, and shows the outcome on the page.

Related Issues

None.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • 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

@javenciu
javenciu requested review from a team and KiroCrewCaptain as code owners November 16, 2026 02:42
@javenciu
javenciu requested a review from CrysisDeu November 16, 2026 02:42
@javenciu
javenciu enabled auto-merge (squash) November 16, 2026 02:42
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — 🔴 changes requested (blocking)

GPT 6.1 found at least one blocking issue that must be resolved before merging 6c9a15f3e4e87b57dec8f35c95b6922ee662031a. Adjudication upheld 2 of 2 blocking finding(s); those must be resolved before merging.

This comment is updated in place on each push.

BLOCKING -- website/src/pages/useArtifactDetailPageCompanion.ts:451 -- Failed sends leave rewrite instructions for an unrelated turn

await api.chatSlotContext(key, instruction, { source: 'artifact-quick-edit', maxAge: 60 })
Trigger: The context POST succeeds, but the subsequent sendTurn POST fails before reaching the gateway. The reader sends an ordinary message in the same companion session within 60 seconds.
Outcome: The failure branch leaves the rewrite instruction queued; prompt_assembly → take_turn_context prepends it to that unrelated message despite the page reporting the quick edit failed.
Anchor: defect
Fix: Submit the instruction atomically with its intended turn, retaining the short display label separately rather than using the next-turn context queue.

BLOCKING -- website/src/pages/ArtifactQuickEditStatus.tsx:34 -- Later snapshots overwrite a completed quick edit’s reported version

line = i18nT('pages.artifactDetailPage.quick_edit_saved', { action: edit.action, version: liveVersion })
Trigger: Shorter saves v3. Without dismissing its status, the reader manually edits the document and chooses Snapshot; handleSave(true) saves v4 and invalidates the artifact query, rerendering useQuickEditStatus.
Outcome: The completed Shorter status changes to “saved as v4,” falsely attributing the manual snapshot to the quick edit. Following its undo guidance by reverting to v3 removes the manual edits while retaining Shorter.
Anchor: defect
Fix: Latch the completed quick edit’s outcome and result version so subsequent artifact updates cannot replace them.

[BLOCK-MERGE] 6c9a15f
[GPT-REVIEWED] 6c9a15f

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

I'm upholding both findings, so neither stops blocking the merge.

F1: I rate the harm MEDIUM. The fix needs a new server-side path and the harm still outweighs that.

  • The instruction is queued at website/src/pages/useArtifactDetailPageCompanion.ts:451 before the turn is sent. At :456-459, any send result other than dispatched, queued or unknown returns null. That includes a readable server refusal (refused, website/src/chat-core/transport/sendTurn.ts:253), not only a network failure. Nothing removes the queued instruction afterwards, and pending_context.py has no route that deletes one.
  • The result: the reader's next message within 60 seconds carries a hidden rewrite instruction, so the agent rewrites their document even though the page said the edit failed. Version history makes it recoverable, but the reader never sees the cause.
  • The real fix is to send the instruction together with its turn, or to add a delete endpoint for queued context. That is moderate work for a wrong change to the reader's document on a plausible path, so the finding keeps blocking.

F2: I rate the harm LOW, but the fix is small, so it keeps blocking.

  • At website/src/pages/ArtifactQuickEditStatus.tsx:33-34, the "saved as" line shows whatever the current version is, re-read every render (ArtifactDetailPageHeader.tsx:280). The status is cleared only by dismissing it (ArtifactQuickEditStatus.tsx:27); starting a manual edit or saving a Snapshot (ArtifactDetailPageHeader.tsx:735) leaves it in place. So after a manual snapshot, the line credits the quick edit with the new version. The undo advice could then lead the reader to revert their own edits; v4 stays in history, so it is recoverable.

  • The fix is to store the version that was current when the quick edit finished. That is a few lines of local state and no hot path, which costs less than the harm prevented.

    [ADJUDICATION] 6c9a15f total=2 uphold=2 downgrade=0
    UPHOLD F1 website/src/pages/useArtifactDetailPageCompanion.ts:451 reason=harm-warrants-remedy
    UPHOLD F2 website/src/pages/ArtifactQuickEditStatus.tsx:34 reason=harm-warrants-remedy
    [GPT-ADJUDICATED] 6c9a15f

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 6c9a15f3e4e87b57dec8f35c95b6922ee662031a false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 6c9a15f3e4e87b57dec8f35c95b6922ee662031a — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: it adds a frontend-only menu on the existing context-then-turn path (the same one Request a Feature uses), every result is saved through the agent's own versioned artifact_update, and rendered evidence is attached.

Notes

  • There is a race between slotBusy and chatSlotContext: a turn that starts after the busy check but before sendTurn could pick up the instruction. The 60-second maxAge limits how long that can last, and the user can fix the result with Revert. If a server-side "context for the next turn only" handshake ever lands, use it here.

[DESIGN-REVIEWED] 6c9a15f

Description read

[DESCRIPTION-READ] dc80e0cc986f1a269e69d6cfd8a69a57914d94fc1043c1b286ab0a84d7503c85

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 16, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 6c9a15f3e4e87b57dec8f35c95b6922ee662031a — 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

The only thing that changes for users is one opt-in submenu, and every new path has at least one real consumer. Two premise-level notes follow.

Notes

  • Item 1 — inherited: the only demand evidence is "Rewrite requests are the most repeated thing readers ask an artifact's agent". No count, issue or log backs it, so the six presets rest on an unmeasured claim.
  • Item 3 — one more truncation helper: editQuotePreview adds a 10th hand-rolled text shortener (grep export function (truncate|shorten)\w* in website/src found 9). shortenTurnPreview in pages/chat/TurnNavigationMinimap.tsx already cuts at a word boundary. Subtraction: delete the 20-line tokenizer and call shortenTurnPreview(quote, 60).

What this change ships

Inventory (9 items) — 7 justified

Intent: let a reader of a document artifact ask the agent for a common rewrite of a passage or the whole document in one click, instead of typing it into the companion chat. ADDITION.

  1. Quick edits submenu in the More menu (Shorter, Longer, Simpler wording, Proofread, Change tone → formal/casual) on live markdown, text and HTML artifacts — inherited (demand asserted, not measured)
  2. The click sends the instruction as hidden background context, and the chat shows only a short line such as "Shorter · selected passage" — justified
  3. The menu label quotes the start of the selected passage, or says "whole document" — second spelling of shortenTurnPreview
  4. The quoted passage is highlighted in the body while the menu is open — justified
  5. A status line on the page shows working, then saved as vN, or finished without a new version — justified
  6. A quick edit is refused with a message while the session is busy — justified
  7. Before the chat panel replaces the comments sidebar, the reader is asked about an unsent comment — justified
  8. The cold-load lookup of the bound session is shared with the sparkle flow (resolveBoundSlot, 2 consumers), and its behaviour there is unchanged — justified
  9. slotBusy is pulled out of slotBusySteer (3 consumers) — justified

[FIRST-PRINCIPLES-REVIEWED] 6c9a15f

Description read

[DESCRIPTION-READ] d2cc4703bc70f475fef5b88ce7985b1406010ba8b0583eace0798c8e515aafc5

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.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🔴 BLOCK

UX-level review of 6c9a15f3e4e87b57dec8f35c95b6922ee662031a — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: BLOCK

cannot evaluate: missing the busy-refusal and "finished without saving" notices. No screenshot shows the selection highlight the PR describes, so readers could not see which passage would be rewritten.

Blockers

Selection quick edit gives no visible cue for the passage
Trigger: the reader selects text, then opens More → Quick edits (shots 09–12).
Outcome: The PR says the passage "is painted with the existing annotate highlight" while the menu is open. Shot 09 shows no highlight in the body. The blind reader said: "nothing in the document looks highlighted… I'd hesitate, because I can't see what is selected." The label also drops "you can revert" for this scope, and the reader added: "this makes me unsure whether I can undo this one." The visual claim has no pixels behind it, and that leaves the scoped edit unclear.
Severity: this is the PR's main path (every selection edit) × hesitation before a rewrite of the user's own text × every time.
Fix: make the highlight visible in a screenshot (or fix it if it doesn't paint), and use the same "you can revert" wording for both scopes.

Evidence gaps

  • quick_edit_busy ("The agent is still working in this chat…"): no screenshot shows where or how this refusal appears. Attach one.
  • quick_edit_unchanged ("…finished without saving a new version. Its reply is in the chat."): not shown. Attach the status line in this state.

Notes

  • quick_edit_saved: after "saved as v4" the Version button still reads "Live", and the reader asked "I can't tell whether 'Live' now means v4". Say "saved as v4 (now Live)".
  • The chat bubble "Shorter · selected passage" reads to the reader as a message the user typed. Mark it as sent from Quick edits.

[UX-REVIEWED] 6c9a15f

Description read

[DESCRIPTION-READ] 64cebe6e842157e01fce1b30cf4d265b8b0365491fd0610488119850e067caa0

That sha256 names everything this verdict read: the PR description, plus the 15 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 16, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 6c9a15f3e4e87b57dec8f35c95b6922ee662031a — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 6c9a15f

Verdict parsed from the review's SHA-scoped output markers for commit 6c9a15f3e4e87b57dec8f35c95b6922ee662031a.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 6c9a15f3e4e87b57dec8f35c95b6922ee662031a false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 16, 2026
@javenciu
javenciu force-pushed the feat/artifact-edit-shortcuts branch from 89f4d2c to f798548 Compare November 16, 2026 03:50
@javenciu

Copy link
Copy Markdown
Contributor Author

UX block (undo is not stated). Fixed in f798548. The submenu label now reads "Agent rewrites the selected text · saved as a new version", or "the whole document" with no selection, in all 13 catalogs. The Quick edits row uses a pen icon instead of the chat toggle's sparkle. Both submenu rows (Quick edits, Change tone) carry a chevron. The chevron is local to these two rows: the shared submenu trigger is used by 12 other menus, so a change there would alter every one of them, which is out of scope for this PR. After a pick the chat panel opens on the companion session and the sent turn appears in its transcript; the last pair of stills shows it. Test that fails on the old head: "applies a shortcut to the whole document when nothing is selected", "scopes a shortcut to the selected passage", and "marks the Quick edits row with a pen...".

UX evidence gaps. The description now carries stills, light and dark, of the submenu with a selection, with nothing selected (whole-document label), with Change tone expanded, and the chat holding the sent quick-edit turn. The harness mocks the transcript to show that turn, since it has no gateway.

Sidebar drafts lost (useArtifactDetailPageCompanion.ts:413). Fixed in f798548. Picking an item now goes through guardSidebarLeave, which asks with the page's own discard prompt when the comments sidebar holds an unsent add, reply or edit box, and sends only after the reader agrees. Cancel keeps the draft and sends nothing. It also runs in a popout, where the panel is swapped in place. The selection box and the thread popover stay mounted across the switch, so they are not asked about. Tests that fail on the old head: "asks before a half-written sidebar comment is replaced by the chat" (main window and popout) and "sends once the half-written sidebar comment is discarded". As with the existing send-to-session guard, a discard is final even if the later send fails.

Selected passage lost after autofocus (ArtifactDetailPageHeader.tsx:254). Fixed in f798548. useSelectionComposerAnchor now keeps the text the box was opened on, taken in onOpen, before focus moves into the input. The menu uses the live selection first, then that passage, then the HTML body's relayed selection. Test that fails on the old head: "keeps the passage picked with the mouse after the selection box takes focus". A real-mouse run on loopback confirmed it: the live selection read empty after the box took focus, and the sent turn still named the passage.

Failed lookup creates a duplicate session (useArtifactDetailPageCompanion.ts:418). Fixed in f798548. A failed slots lookup now shows its error on the page's notice stack, sends nothing, and does not switch panels; a session is created only after a lookup that succeeded and found none. Test that fails on the old head: "shows the error and creates no second session when the session lookup fails". Two further tests pin the cold success paths (sends to the found session, creates one when none exists), which pass on both heads.

First-principles note (second copy of the cold-load step). Taken. resolveBoundSlot in the companion hook is now the single "resolve the bound session" step; openCompanionChat and sendEditShortcut both call it. openCompanionChat keeps its existing behavior of falling through to create when the lookup fails; only the new shortcut treats a failed lookup as a stop, so main's outcome is unchanged. The existing companion-chat tests pass unchanged.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 16, 2026
@javenciu
javenciu force-pushed the feat/artifact-edit-shortcuts branch from f798548 to 9948ee5 Compare November 16, 2026 05:16
@javenciu

Copy link
Copy Markdown
Contributor Author

Rebased onto current main as 9948ee5844, with no code change, because the version-compare change that merged (#37657) edited the same page of src/kiro_crew/docs/artifacts.md. The page now keeps its Compare paragraph and this PR's Quick edits section one after the other. On the new head the quick-edits and compare tests and the src/i18n suites give 83 files passed, the i18n check and the docs lint pass, and the lane CI checks pass.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 16, 2026
@javenciu
javenciu force-pushed the feat/artifact-edit-shortcuts branch from 9948ee5 to edd99fd Compare November 16, 2026 07:47
@javenciu

Copy link
Copy Markdown
Contributor Author

UX BLOCK, the rewrite target is not visible (fixed in edd99fd). The Quick edits label now quotes the start of the passage the menu was opened on: Agent rewrites “We ship on Tuesday, after the team has finished running…” · saved as a new version. The quote is the first 60 characters on one line, cut at a word and ended with "…", and it is plain text. The whole-document label is unchanged. The label string takes {{passage}} in all 13 catalogs, with each language's own quotation marks, and the style suites pass with the base ref set. The selected-text and tone menu stills are retaken in light and dark. Tests that fail on the previous head: "scopes a shortcut to the selected passage", "keeps the passage picked with the mouse after the selection box takes focus" and "shows a long passage cut at a word with an ellipsis, on one line". The cut itself is pinned by "previews a passage on one line, cut between words and ended with an ellipsis".

GPT BLOCKING, recheck comment drafts after the session lookup (fixed in edd99fd). sendEditShortcut now asks the sidebar-draft guard again after the lookup and right before setPanel('chat'). If the person keeps the draft, nothing is sent and no session is created. If they discard it, the shortcut sends. The guard is one function (confirmSidebarLeave) used both before and after the lookup. Tests that fail on the previous head: "asks again after the session lookup when a comment was typed during the wait, and sends nothing if it is kept" and "sends after the second ask when the comment typed during the lookup is discarded".

First principles, the Sparkle button is not guarded. Not changed. The Sparkle button swaps the same panel, but its behaviour is main's. It has several entry points (the toggle, the cold-load path, the create path and "Ask agent" from the sidebar), so a guard there is not a one-line change and would be a second mechanism in this PR.

@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: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 16, 2026
Add a Quick edits submenu to the artifact page's More menu for markdown,
text and HTML artifacts: Shorter, Longer, Simpler wording, Proofread and
Change tone (more formal or more casual). Each item sends one preset
instruction to the artifact's companion chat for the selected text, or the
whole document when nothing is selected, and the agent applies it through
its normal artifact update, which keeps the version history.

Nothing is sent until an item is picked or while the gateway is
disconnected. Other kinds show no menu, as before. No new route and no
setting.
@javenciu
javenciu force-pushed the feat/artifact-edit-shortcuts branch from edd99fd to 6c9a15f Compare November 16, 2026 15:19
@javenciu

Copy link
Copy Markdown
Contributor Author

The sent turn showed the raw instruction as the reader's own message. Fixed with the pattern the top bar's Request a Feature already uses (website/src/shell/topbar/requestFeature.ts). The instruction now goes to the bound session as background context through api.chatSlotContext(slot, text, { source: 'artifact-quick-edit', maxAge: 60 }). The visible turn is one short catalog line in the reader's language, such as "Shorter · selected passage" or "Proofread · whole document", with no passage text, because user bubbles render as markdown. The instruction's first sentence ties it to that line ("The user's next message is a Quick edit picked on the artifact page."). If the context write fails, nothing is sent and the reason goes on the page's notice stack, because the short line means nothing without its instruction. maxAge makes an instruction whose visible send fails expire instead of attaching to a later message. The edit is refused while the bound session is busy (a turn running or sub-agents active, the same reads slotBusySteer takes, now shared as slotBusy in busySend.tsx). The reason: the context drain hands background context to the next turn that starts, so a send queued or steered behind a running turn could pair the instruction with another message. Tests that fail on the previous head: "shows a short line as the turn and hands the instruction over as background context first", "sends nothing and shows the reason when the background context is refused", and "sends nothing and writes no context while the bound session is busy".

Nothing said whether the rewrite was running, finished or failed. One role="status" line now sits in the page's notice area from the moment the server takes the send: "Shorter: the agent is rewriting the selected passage…". It changes to "Shorter: saved as v4. To undo, pick the earlier version under Version and press Revert." when the live ['artifact', slug] record (which the artifact_update event already refreshes) rises above the version at send time. When the session's turn has started and ended with the version unchanged, it reads "Shorter: the agent finished without saving a new version. Its reply is in the chat." The saved and unchanged states have a dismiss button. A new quick edit, another artifact or leaving the page clears the line. It is kept in memory only, with no store slice, polling or timer (website/src/pages/ArtifactQuickEditStatus.tsx). A busy refusal uses the same line: "The agent is still working in this chat. Try the quick edit again when it finishes." Tests that fail on the previous head: "follows the edit on one status line: working, then saved as the new version", "says the agent finished without a new version when its turn ends and the version did not move" and "replaces the status line with the next quick edit".

Note: the quoted passage was not highlighted while the menu was open. For markdown and text bodies, the menu now paints the passage it quotes with the existing paintAnnotationHighlight (the mc-annotate highlight the comment box already uses) while the menu is open, and clears it when the menu closes. That took a few lines in ArtifactDetailPageHeader.tsx. HTML bodies render in an iframe the page cannot paint, so the menu's quote is the cue there.

Note: the whole-document rewrite showed no way back. The scope label now reads "Agent rewrites the whole document · saved as a new version you can revert", in all 13 catalogs. The saved status line names the controls that undo it (Version, then Revert).

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 16, 2026
@javenciu

Copy link
Copy Markdown
Contributor Author

One design question before another round. This PR has had four UX rounds, and the blocking GPT finding on 6c9a15f3e4 is a design call rather than a slip, so I'd like a maintainer's direction before the next push.

How the instruction travels with its turn (GPT, useArtifactDetailPageCompanion.ts:451). Round 3 sends the instruction through POST /api/chat/slots/{slot}/context and then a short visible turn, the pattern Request a Feature uses. When the context write lands and the turn's POST fails, the queued instruction waits for the reader's next message in that session (up to its 60-second maxAge), and the pending-context queue has no route that removes an entry. Two options:

  • (a) Send one turn whose wire text is the instruction, with a meta label the chat renders as a short "Quick edit · Shorter · selected passage" chip, which expands to show the full instruction, the way the knowledge chip and paste chips do today. One POST, frontend only, and nothing can wait for another message.
  • (b) Let POST /api/chat take an optional context field that is drained into that same turn, so a short visible line and its hidden instruction arrive together. One POST, a server change.

Which would you prefer, or should Quick edits wait? The other open items will go into the same round: keep the saved version a status line reports when later saves happen (GPT, ArtifactQuickEditStatus.tsx:34), screenshots of the busy and "finished without a new version" notices and of the passage highlight, "you can revert" for both scopes, and the existing shortenTurnPreview in place of the new preview helper.

I'll hold further pushes on this PR until a maintainer weighs in.

@github-actions github-actions Bot added 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: checking Automated validation is still running labels Nov 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant