Skip to content

fix(files): cap how long a room delivery waits for its refetches - #9427

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/invalidation-delivery-cap
Oct 29, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
fix/invalidation-delivery-cap

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • The room coalescing from perf(db): cut hot-path database work and close copilot cleanup gaps #9419 awaits each delivery's refetches before the next delivery, but a fetch has no timeout of its own: one that hung held the room's deliveries forever, so the tab stopped picking up remote file changes
  • Each delivery now waits at most DELIVERY_SETTLE_CAP_MS (60s, above the slowest list read) via the existing withinDeadline helper, which clears its timer; past it, the next delivery's invalidateQueries (cancelRefetch: true) cancels and restarts the hung fetch, the recovery every broadcast gave before coalescing
  • Normal deliveries are unchanged: a refetch that settles within the cap is still waited for, never overlapped; a hung first load (no cached data) is joined rather than restarted, as before

Type of Change

  • Bug fix

Testing

  • New test: a refetch that never settles no longer blocks the next delivery; fails on the pre-fix hook ("expected 2 times, got 1"), passes after; the existing coalescing tests still pass (6/6)
  • bun run lint, bun run check:audits (61), bun run type-check

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

The coalescing in #9419 awaits each delivery's refetches before the next one starts, so a refetch still in flight is neither cancelled nor overlapped. A fetch has no timeout of its own, so one that hung held the room's deliveries forever and the tab stopped picking up remote changes. Each delivery now waits at most DELIVERY_SETTLE_CAP_MS; past it, the next delivery's invalidation cancels and restarts the hung fetch, as every broadcast did before coalescing.

Autopsy: the coalescing tests covered a refetch that settles late, never one that does not settle.
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 29, 2026 12:42am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Caps how long each room delivery waits for its refetches.

  • Workspace room refreshes resume after a callback waits longer than 60 seconds.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Room change arrives] --> B[Run callbacks]
  B --> C[Wait for refetches or 60-second cap]
  C --> D[Wait one second]
  D --> E{More changes arrived?}
  E -->|Yes| B
  E -->|No| F[Finish delivery]
Loading

Reviews (3) · Last reviewed commit: "fix(files): cap a room delivery's wait a..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit e05cf89 into staging Oct 29, 2026
63 of 64 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/invalidation-delivery-cap branch October 29, 2026 00:55
waleedlatif1 added a commit that referenced this pull request Oct 29, 2026
…and make room refetches wait (#9433)

Release-review fixes for #9419/#9427: room callbacks must return their invalidations (tables and workflows rooms now wait for their refetches); the deployed-state hint is set only by active reads; chat cleanup keeps any chat-scoped key a surviving chat in its scope still attaches (one query per scope) and collects a forked workspace upload once no file row names it; inline images are swept by their chat prefix through their own outbox event; malformed attachment keys are skipped. Legacy queued payloads are still accepted.

This branch was previously deployed

1 inactive deployment
Preview — bf44de48 Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant