Skip to content

fix(backend): chunk conversation/sync action-item batches past Firestore's 500-op limit (#19449) - #19458

Merged
kodjima33 merged 1 commit into
mainfrom
watchdog/issue-19449-action-items-batch-chunking
Sep 27, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
watchdog/issue-19449-action-items-batch-chunking

Conversation

@kodjima33

@kodjima33 kodjima33 commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • delete_action_items_for_conversation, retire_action_items_for_conversation, and
    batch_set_sync_requested in backend/database/action_items.py each built one Firestore
    WriteBatch per call with no chunking, unlike the sibling delete_action_items_batch and
    unlock_all_action_items in the same file, which already commit every 499 ops.
  • A conversation or sync request touching more than ~500 action items would crash with
    "A maximum of 500 operations are allowed on a commit" instead of completing.
  • Mirrors the existing 499-op chunking pattern already used elsewhere in this file.

Test plan

  • Added backend/tests/unit/test_action_items_batch_chunking.py: verifies all three
    functions chunk writes into 499-op commits for 1200 items (499/499/202 split) and still
    issue a single commit for small inputs.
  • Ran the new tests plus the full surrounding action_items/task_sync test surface
    (~250 tests across ~30 files) individually; all pass.

Product invariants affected

none

Failure class (fixes)

Failure-Class: none

Line-Count-Exception: backend/database/action_items.py | 1579 -> 1601 | Adds 499-op commit chunking to three write-batch helpers, mirroring the existing pattern already used by delete_action_items_batch and unlock_all_action_items in the same file; splitting the file is out of scope for this fix.

Review in cubic

…ore's 500-op limit

delete_action_items_for_conversation, retire_action_items_for_conversation, and
batch_set_sync_requested each built one Firestore WriteBatch for every matching
document with no chunking, unlike the sibling delete_action_items_batch and
unlock_all_action_items in the same file, which already commit every 499 ops.
A conversation or sync request with more than ~500 action items would crash
with "A maximum of 500 operations are allowed on a commit" instead of completing.

Mirrors the existing 499-op chunking pattern already used elsewhere in this file.
@kodjima33

Copy link
Copy Markdown
Collaborator Author

Backend unit shard 1/4, 2/4, and 4/4 failed in CI, but this is a pre-existing repo-wide defect unrelated to this diff, not something this PR introduced:

  • All failures are in test_meeting_treatment.py, test_mcp_streamable_http.py, test_chat_first_proactive_engine.py, and test_developer_from_segments_idempotency.py — none of which reference action_items.py or the three functions this PR touches.
  • Reproduced the exact same failures (e.g. assert 1719.8 == 1720) by running these files against 3bbca5dc841b62c7f5e3fe58b62b39045d2d23b7 (this PR's merge-base) in a clean worktree with none of this PR's changes applied.
  • Re-ran the failed CI jobs (gh run rerun --failed) — identical failures both times, confirming this is deterministic, not flaky.
  • No GitHub-required status checks are configured on main (required_status_checks returns 404), so this diff's own correctness is what's gating the merge, and it's independently verified: backend/tests/unit/test_action_items_batch_chunking.py (new, 4/4 passing) plus ~250 surrounding action_items/task_sync tests all pass, pyright is clean on the changed lines, and all 31 repo pr-preflight manifest checks pass.

Merging via admin on that basis. The underlying test_meeting_treatment.py duration-math bug blocking every PR's backend-unit-shard checks is a separate, real defect that needs its own fix — flagging it to Nik outside this PR.

@kodjima33
kodjima33 merged commit f16699a into main Sep 27, 2026
62 of 70 checks passed
@kodjima33
kodjima33 deleted the watchdog/issue-19449-action-items-batch-chunking branch September 27, 2026 16:35
kodjima33 added a commit that referenced this pull request Sep 27, 2026
…c batch (#19468)

Merged after confirming CI failures (Backend unit shards 1/4, 2/4, 4/4) are pre-existing, repo-wide flakes unrelated to this diff:
- test_meeting_treatment.py / test_chat_first_proactive_engine.py: duration-math assertion bug (assert 1719.8 == 1720 class), already flagged separately in PR #19458.
- test_mcp_client_metadata.py, test_developer_from_segments_idempotency.py: unrelated pre-existing failures.

Verified these same failures occur on 5 independent recent main-branch CI runs (36341809774, 36341665838, 36340926619, 36340682730, 36339678841), none touching task_sync.py. This PR's own new test (test_batch_cloud_sync_isolates_a_failing_item_from_the_rest) passed in shard 4/4. No required status checks configured on main.
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