Repository navigation
Conversation
… swallowing it Both companion surfaces posted their context fire-and-forget, so a rejected inject left the panel looking ready while the agent had never been told which document it held.
|
🤖 Kiro Crew [operator: NicholasRBowers#a942f9ca]: This PR was flagged for automated triage with failing CI. I've assessed the blockers and they appear resolvable — I'll push fixes directly to this branch as a co-author. Assessment: the only genuine failure is in this PR's own strings. Frontend Tests (2) fails Scope note: I read @bolichen97's 2026-09-25 guidance on #6813 as landing this alongside #12807 rather than behind it, and your description states this change does not depend on that persistence. So I'm treating no sibling PR as a prerequisite, and I will not pull any of #12807's or #6813's work into this branch. If you'd prefer I don't touch this PR, add the |
|
Thank you @rnoack1 for this fix and for the two capture harnesses. The branch was about 3,700 commits behind main, so I carried it to a same-repo PR so CI could run on a fresh base: #20748 (Fixes #20737). Your commit keeps its authorship there. On top of it: the two conflicts were resolved against main ( Closing this in favour of #20748. Your branch is left untouched. |
… swallowing it (#20748) * fix(context): report a failed background-context injection instead of swallowing it Both companion surfaces posted their context fire-and-forget, so a rejected inject left the panel looking ready while the agent had never been told which document it held. Carried from fork PR #12666 onto current main: conflicts in PapyrusPage.tsx (main renamed CHAT_PANEL_WIDTH to chatWidth) and ArtifactDetailPage.tsx (kept main edit-token state beside the new context-notice state); bn/hi/ru copy moved to the informal register the style gates require. Fixes #20737 Co-authored-by: cixuuz <26782336+cixuuz@users.noreply.github.com> Co-authored-by: rnoack1 <69695077+rnoack1@users.noreply.github.com> * fix(context): address review on the companion-context notice Keep both context posts ephemeral (the durable flag was a no-op on main), collapse the duplicate claim-map helpers into the ref, drop two tests that never checked what they named, replace six promise-sleeps with an act() flush, and read the sized co-author column in papyrusResizeAria now that the panel sits beside the notice. Scope the notice retraction to the newest request on the current slot (artifact) or the newest push (Papyrus), so a superseded session late success cannot clear the current failure; clear the Papyrus notice when the paper changes. Co-authored-by: rnoack1 <69695077+rnoack1@users.noreply.github.com> --------- Co-authored-by: m <m@e> Co-authored-by: cixuuz <26782336+cixuuz@users.noreply.github.com> Co-authored-by: rnoack1 <69695077+rnoack1@users.noreply.github.com>
Problem / Motivation
Opening the artifact companion chat, or the Papyrus co-author, silently POSTs
/api/chat/slots/<slot>/contextso the agent is told which document it is holding. Bothposts were fire-and-forget (
.catch(() => undefined)). When that POST was rejected thepanel still opened looking ready, so the user typed "summarize this" against an agent that
had never been told what "this" was.
On the artifact page the failure was worse than silent: it was routed through the page's
SAVE-error channel, so a background enqueue failure told a user with a dirty editor buffer
that their work had not been written.
Why it matters
The failure is invisible at exactly the moment the user acts on it. They get a confident
but unanchored answer and no reason to suspect the attach step, which is the one thing
they cannot see. The misrouted save error is worse: it reports data loss that did not
happen, on a page holding unsaved edits.
What changed (motivation → approach → change)
Symptom: a rejected context POST left no user-visible trace on either surface (and on the
artifact page surfaced as a save failure). Root cause: the POST had no result handling at
all — a bare
.catchswallowing every rejection, and no state to render one.Each surface now owns a notice in its own chat column, mounted beside the composer its
copy names, and retracts it when a later inject succeeds. The artifact notice distinguishes
a first attach from a staleness refresh: a failed refresh means only the newest version is
missing, not that nothing was shared, and labelling that "not attached" was itself wrong.
The POST is routed through
useMutation, like every other write on these pages, ratherthan a bare promise chain. A memory-only claim map is held before the request so an
open/close/reopen inside the request window cannot inject twice; a rejected post releases
the claim so the next open retries instead of recording a delivered baseline. The claim is
deliberately not persisted — a resolved POST is not a durable-write acknowledgment, so a
claim outliving the page could suppress a nudge for an entry that was never stored.
Both posts gain
maxAge(3600s). Without a TTL a dormant slot accumulates entries against_MAX_CONTEXT_PER_SOURCE(10) and every later post answers 429.ArtifactChatPanelloses its fixedcalc(100vh - 240px)height for flex. With the noticeabove it in the same column, a fixed height put the composer past the fold whenever both
mounted.
Backwards compatibility
Compatible. No request field is added or removed, no validator is tightened, and no
existing key changes meaning.
ephemeral: falseandmaxAgeare existing optionalparameters of
POST /api/chat/slots/{slot}/context, both already accepted on main.One deliberate no-op:
ephemeral: falsestates that these entries are durability requests.The boundary stores the flag, but
drain_pending_contextclears the queue unconditionallyand never reads it, so on main this changes no behaviour. The persistence that honours it
is a separate change; this PR does not depend on it and does not claim it.
Tests
Website only; no Python source is touched.
ArtifactDetailPage.companionChat.test.tsx— the notice appears on a rejected inject andis titled for the context failure rather than the save failure; it is taken down with the
panel so it never names an absent composer; it mounts inside the chat column, not at page
top; the panel carries no fixed height; a 429 records no delivered injection; a first
failed share is never relabelled as a staleness failure; a user turn does not retract it.
ArtifactDetailPageCoverage.test.tsx— a stale session re-open nudges rather than takinga silent baseline; the stale body names the version.
PapyrusPageCoverage.test.tsx— the paper's identity is handed over silently; a 429context_not_queuedrenders the capacity wording rather than the generic copy.Manual verification
Run locally against a clean install at this commit:
npm run test:website(the full website suite, with coverage) — 2239 test filespassed, 36510 tests passed, 1 expected-fail, 2 skipped, 0 failed.
npm run typecheck,lint,lint:i18n,lint:phantom-classes,lint:theme-colors—all clean.
npm run build— green.npm installleftwebsite/package-lock.jsonbyte-identical, so the lockfile isunchanged by this branch.
Screenshots / video
Four frames, produced by the two harnesses this PR adds. They assert as well as photograph
— each scene exits non-zero unless the notice rendered with its own title rather than the
save-failure title, so a regression that reroutes it back into the save channel fails the
run instead of producing a screenshot nobody re-reads:
Both need
npm ci && npm run buildfirst. The generic frame shows the notice as its ownred banner reading "Couldn't share the latest version with the agent", carrying the
mention-to-recover instruction and its own dismiss control, beside an Agent chat panel that
is unaffected — i.e. the failure is reported in the context channel and not as a save
error.
Related Issues
N/A — no tracking issue.
Pattern harvest
Rule candidate: review-prompt
Pattern: a background write whose only failure handling is
.catch(() => undefined)— theuser acts on the assumption it succeeded, and where the surface has an unrelated error
channel in scope, the rejection gets rendered as that channel's failure instead, so the
report is not merely absent but wrong.
Checklist