Skip to content

feat(backend): default smart merge to merge mode with an off kill switch - #19807

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/smart-merge-default-on
Sep 29, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/smart-merge-default-on

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Makes smart merge (#19777) on by default. With CONVERSATION_SMART_MERGE_MODE unset or blank the durable finalizer now runs in merge mode: a finished pendant conversation that Jev judges the same occasion as its predecessor (p_same >= 0.35, 2-60 min gap, same device, both sides >= 25 words, nothing user-managed) is folded into that predecessor.

This was David's explicit call on 2026-09-29. It overrides the offline benchmark's own verdict (shadow-only; unattended merging only after >= 100 reviewed live negatives with <= 1 false merge).

Behaviour

CONVERSATION_SMART_MERGE_MODE Result
unset / blank merge (new default)
merge fold
shadow decide and record, never merge
off kill switch: one env read, no reads/model call/writes
any other value (of, disabled, false, ...) off

The last row is deliberate: the variable is the kill switch, so a typo must stop merging and never keep it running. CONVERSATION_SMART_MERGE_UID_ALLOWLIST is unchanged (empty = every user).

Changes: backend/config/conversation_smart_merge.py (default + parsing), the flag registry entry (fail: open, decision: graduate) and its rendered doc, the two ARCHITECTURE/pipeline docs, and tests. The tests that meant "flag off" now set off explicitly; new tests cover unset, blank, whitespace, case, and typo-to-off.

Also included: OpenAPI contract regeneration

Main has failed OpenAPI Contract / Public Developer API contract on every run since 2026-09-29T14:43Z: a Stripe Connect return-route docstring changed without regenerating docs/api-reference/app-client-openapi.json. This PR carries the one-line regeneration (backend/scripts/openapi_runner.sh scripts/export_openapi.py --surface app-client --write ../docs/api-reference/app-client-openapi.json) so its own CI can go green. It is unrelated to smart merge; if another PR lands the same regeneration first, this file will simply match.

Rollback / kill switch

Set CONVERSATION_SMART_MERGE_MODE=off on each service that runs the finalizer (Cloud Run backend / backend-sync, and the GKE pusher). Leaving the variable unset no longer disables the feature. Conversations already merged stay merged: the donor's document and original audio are retained as a redirect tombstone, and reversing a merge is a manual operator job (no route or script exists).

Verified (hermetic)

  • 17 backend test files through backend/test.sh file lists (smart-merge config/policy/state/orchestration/finalizer, finalization, JIT, duplicate capture, free-tier branch, pusher failure severity, relevance, discard revival, sync v2 / Cloud Tasks / bridge lifecycle / cross-job assignment): all passed. The first cold run tripped the runner's timing guard on two files; both pass in isolation and the full list passed again.
  • scripts/check_feature_flag_registry.py: OK.

Not verified

  • No real Jev call, real Firestore contention, real process_conversation refresh, or client rendering of a merged conversation. The prod gateway's Jev credential and LLM_GATEWAY_URL wiring are not checked from this change; if Jev is unreachable the step fails open and nothing merges.
  • Known risks carried over from feat(backend): fold silence-split pendant conversations with Jev (default off, shadow/merge modes) #19777: thin threshold margin (0.03-0.045 over the nearest benchmark negatives); one survivor refresh per absorb; the macOS cache and Flutter resume path can keep showing a merged-away row until a full refresh; a BYOK-only survivor may owe a refresh that cannot run.

Deploy targets

backend (Cloud Run backend + backend-sync, same image) and pusher (GKE). No listen change.

Product invariants affected

None. This change only flips a flag default and its documentation; it adds no writer and touches no processor.

🤖 Generated with Claude Code

Git-on-my-level and others added 2 commits September 29, 2026 23:04
Unset or blank CONVERSATION_SMART_MERGE_MODE now means merge. off is the kill
switch and any unrecognized value also means off, so a typo in the kill switch
can never leave merging on. Registry entry becomes fail=open / graduate.

David's explicit call on 2026-09-29; it overrides the benchmark's shadow-only
verdict.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Main has failed OpenAPI Contract since 14:43Z on 2026-09-29: a Stripe Connect
return-route docstring changed without regenerating
docs/api-reference/app-client-openapi.json. One-line regeneration with
`backend/scripts/openapi_runner.sh scripts/export_openapi.py --surface app-client --write`.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@mintlify

mintlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Sep 29, 2026, 4:17 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@Git-on-my-level
Git-on-my-level merged commit c12ddab into main Sep 29, 2026
51 of 54 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/smart-merge-default-on branch September 29, 2026 16:30

This branch was successfully deployed

1 active deployment
staging - docs — f5f51183 Deployed Sep 29, 2026 by mintlify[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