Skip to content

Bug: Inbox editor emits an uncaught Milkdown error after rapid send #3567

Closed

Description

@yannickmonney

Observed failure

Rapidly typing into the real Inbox Milkdown editor and immediately sending a message with a previously attached file can produce an uncaught error after the successful-send remount:

MilkdownError: Context "editorView" not found, do you forget to inject it?
  contextNotFound → Container.get → Ctx.use → Ctx.get
  @milkdown/crepe Object.runner → SerializerState.next

This is a lifecycle follow-up to #3565. The observed impact is an unhandled browser error. No additional user-visible malfunction or mail-delivery failure is claimed here.

Local evidence

  • Real Chromium, actual ConversationPanel, ComposeEmailPane, MessageEditor and send adapters; HTTP mocked to successful local responses, synthetic file/address fixtures only.
  • Base source 17c6e6ed16ee880eff4b9b18985f7af8e2e9295d; installed Milkdown packages 7.20.0.
  • Attach invoice.pdf, type Urgent, immediately click Send message within about 100–112ms of starting to type, while the 200ms Markdown listener debounce is pending. The editor remounts after success.
  • The original probe reports the payload loss documented in Bug: immediate Inbox Send can drop visible message text #3565 and the uncaught editorView error.
  • After applying Bug: immediate Inbox Send can drop visible message text #3565's live-snapshot source fix in a separate scratch checkout, all 4 body-payload assertions pass (immediate and delayed controls for reply/compose), but Vitest still reports 2 unhandled errors with the stack above and exits nonzero. Thus the lifecycle exception remains after the outgoing-body fix.
  • No blanket console/error suppression or ignored-unhandled-error option was used for that post-fix probe.

The natural-timing probe is distinct from #3565's deterministic data-consistency test. That test holds delivery at the public markdownUpdated listener boundary, lets the internal debounce callback finish, then sends with deliberately stale app draft state. It proves live serialization under delayed publication without racing a timer or suppressing exceptions. The natural probe sends while the real internal timer is pending and exposes this separate teardown path.

Source lead

MessageEditor remounts its MilkdownProvider after successful send.

In installed @milkdown/plugin-listener/src/index.ts, debouncedHandler serializes a saved transaction document after 200ms (lines 165–185). The plugin's view destroy hook (lines 190–194) notifies destroy listeners but does not cancel that scheduled handler. The stack reaches a Crepe serializer that reads the already-removed editorView context. This is a source-supported cause hypothesis to validate when fixing the lifecycle.

Acceptance

  • Preserve current editor text and attachment-only sends.
  • Sending/remounting or otherwise disposing an editor while Markdown publication is pending must produce no later uncaught context error.
  • Cover real editor teardown with a deterministic pending-publication test; do not solve it by increasing debounce delays or swallowing all errors.

Evidence retained locally in /Users/yannick/.codex/notes/tale-immediate-send-20260928/: browser-fast-send.log, browser-control.log, browser-after-snapshot.log, and the scratch fixture/worktree. Deduplication checked open/closed issues for editorView, Milkdown/destroy and related editor work; #3565 mentions this as secondary evidence but no separate lifecycle issue exists.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: lowservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions