Repository navigation
[backport cloud/1.56] fix(agent): notify refused promoted writes and refuse before the doc catches up - #21312
comfy-pr-bot wants to merge 1 commit into
Conversation
…catches up (#20516) ## Summary A promoted subgraph-host widget write that the agent CRDT minter refuses now reports telemetry and shows the same rejected-edit toast as a host rejection. The minter also refuses a promoted write until the follower document has caught up, unless this tab enqueued the host's `add_node` into that document. Part of PM-1995, follow-up to #20377. - **Refusals:** `promotedHostWrite` returns a refusal (`unpromoted_widget`, `doc_not_synced`, `layout_drift`). `mintSetWidget` reports each one once per minter, per workflow and host (per widget for `agent_crdt_promoted_widget_not_promoted`), then calls `onWidgetWriteRefused`. - **Toast:** `AgentPanelRoot` routes `onWidgetWriteRefused` to the follower's existing rejected-op notifier. Local refusals and host rejections share one throttle per rendered message. - **Catch-up gate:** the follower answers `mayWritePromotedHost`. It returns true once `LayoutFollowerBridge.isSubscribeBaselineIntegrated` holds (an acknowledged subscribe whose integrated seq reaches the ack, with a readable schema). It also returns true for a host this tab enqueued an `add_node` for into the same follower document, while that document does not hold the host yet. - **Bridge evidence:** the bridge keeps `integratedSeq` per follower document. A catch-up credits every frame applied since the send, and a live frame credits only itself when it is contiguous with what is already integrated. The first frame applied before an ack is checked when the ack lands, and a frame past ack + 1 is reported as `doc_gap` and triggers a resubscribe. - **Known limitations:** - A promoted edit made between a resubscribe's send and its ack is refused with a toast, not deferred. Resubscribes include the 30 s stale probe, a reconnect, a gap resync, and an ack-timeout retry. - While a subscription is refused, the schema is unreadable, or the workflow is not minted yet (seq-0 ack), every promoted edit is refused and toasted. - The toast copy (`agent.editRejected.widgetWrite`) is the host-rejection copy. ## Verification - `vitest run src/workbench/extensions/agent/`: 160 files pass. `pnpm typecheck`, knip, oxfmt, oxlint, eslint, and the pre-push fallow audit are clean. - Bridge tests in `followerSubscription.test.ts` cover: - waiting for a catch-up; - an already-current resubscribe; - live progress that overtakes an ack; - repeated, refused, and retried subscribes; - a gap resubscribe; - a pre-ack frame past the ack reported as a gap; - baseline zero; - the schema gate; - a rejection after an accepted ack; - discarding a replayed frame after a resubscribe. - `useAgentCrdtFollower.humanAddTabSwitch.test.ts` drives the real follower and checks `mayWritePromotedHost` before and after catch-up, for a host this tab added, and after `doc_reset`. `useAgentCrdtFollower.rejectedWidgetWrite.test.ts` checks that a local refusal and a host rejection share one toast. - Each new test fails when the behaviour it covers is removed (mutation-checked). - No browser check of the toast. The rendered toast is the existing host-rejection toast; only its trigger is new. --------- Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>
📦 Bundle Size
⚡ Performance
🔬 E2E Coverage
🎨 Storybook: ✅ Built — View Storybook🌾 Fallow: ✅ PassedFallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened. No new findings in the changed files. Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since 1b0ddf2ef25caee1fb682ca2f08b352475983bdf
Full docs: ADR-DEVEX-LINT-0015 |
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 9 Pipeline jobs failed
Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 80c6872 | Docs | View more details | Give us feedback! |
christian-byrne
left a comment
There was a problem hiding this comment.
Blocked: the cloud/1.56 backport does not typecheck at this head.
Full context for agent readers
The implementation matches the merged change, but the older target branch exposes two compatibility gaps. The real lint-pr / typecheck job fails in its application typecheck step; the downstream setup, lint, test, and E2E failures are short-circuit fallout.
I left the two actionable defects inline. Please backfill the older-branch fixtures with the new required dependencies and use the toast helper that exists on this branch.
| * False until the bound document has caught up, unless this tab already | ||
| * sent the root host's `add_node` into the same document. | ||
| */ | ||
| mayWritePromotedHost(nodeId: NodeId): boolean |
There was a problem hiding this comment.
Blocking: making these dependencies required breaks the two existing cloud/1.56 fixtures in agentBuiltWidgetInputLink.regression.test.ts at lines 156 and 219. The real typecheck reports TS2739 because both objects omit mayWritePromotedHost and onWidgetWriteRefused. Please backfill those fixtures (or provide compatible defaults) so the target branch builds.
| const { submit, follower } = mountFollower() | ||
|
|
||
| follower.notifyWidgetWriteRefused() | ||
| expect(toastDescriptions()).toEqual([ |
There was a problem hiding this comment.
Blocking: this target branch defines toastDetails(), not toastDescriptions(). Both new assertions here (lines 296 and 301) fail with TS2304. Please use the existing branch helper so this regression test typechecks.
|
Closing: production has already advanced past 1.56, so this cloud/1.56 change is no longer needed. |
Pull request was closed
Backport of #20516 to
cloud/1.56Automatically created by backport workflow.