Skip to content

config: ramp memory_list_index_window 25 -> 100 (48h soak clean at 25%) - #23536

Closed
Git-on-my-level wants to merge 1 commit into
mainfrom
lane/mem-index-window-100
Closed

Git-on-my-level wants to merge 1 commit into
mainfrom
lane/mem-index-window-100

Conversation

@Git-on-my-level

Copy link
Copy Markdown
Member

Summary

Ramp memory_list_index_window 25 -> 100 in FIRESTORE_READ_LEVERS. Complete 16-key literal, every other key unchanged; same 9-file surface as the precedent 5 -> 25 step (68e9422).

Why: 48h soak gate at 25% — CLEAN

Windows: post-roll 2026-10-22T17:25Z -> 2026-10-24T17:55Z (48.5h) vs pre-roll baseline 2026-10-21T14:00Z -> 10-22T14:06Z (24.1h); full Cloud Logging census (no sampling), GET /v3/memories list-endpoint 200s on cloud_run/backend: n=11,761 post vs n=6,396 pre (volume 265 -> 242 req/h, -9% — comparison is volume-matched).

  • Latency: p50 0.81 -> 0.92s, p95 7.26 -> 7.47s (stable), p99 17.33 -> 16.28s (improved); walks >24s 25.9 -> 16.8 per 24h (-35%); >10s flat (163 vs 314 per window ≈ 6.8 vs 6.5/h).
  • 5xx (any method, /v3/memories*): 431 in the pre window (reproduces the 433/24h baseline) -> 20 total post (~10/24h), improving on every post day (4 / 13 / 3). No new 5xx regime.
  • Truncation proxy (slow >20s walk with <=400B body): 17.9 -> 17.3 per 24h (flat). Honest outlier: one 67.4s walk on 10-23T01:28Z on the roll rev (1 of 11,761; pre-window max 29.3s, zero >30s) — single event near that rev's 02:07Z revision switch, not a regime; watched again post-100.
  • PostHog Product Error error_kind=memories_fetch daily 10-21 -> 10-24: 11, 12, 10, 6 (distinct uids 9, 9, 7, 4) — flat-to-down. (Client-emission floor; older builds log only to Crashlytics.)
  • Soak validity: memory_list_index_window = 25 verified in the frozen env of all 8 revisions that served the post window (backend-02106-v9p, 5c1dec0, 02109-qzv, 02110-r8d, 4d3c06c, 02113-9c9, 45d465b, 57d9b3e), and in the live service env at answer time — the soak measured the intended config end to end.

Per-runbook comparison (backend/docs/runbooks/list-read-serving.md): list latency, 504/500 counts, truncation rate — all three clean.

Ramp plan (dated expansion checkpoint)

  • Now: 100% on the next Cloud Run backend train (lead-owned); merge + train by 2026-10-27 per PR config: ramp memory_list_index_window 5 -> 25 (mobile Memories page timeouts) #23310's ramp plan.
  • Post-100 verification checkpoint: 48h after the 100% train serves (by 2026-10-29), same runbook comparison vs this 25% soak window; owner: hermes lane (this PR's author); lead owns the merge/train. Escalate to the firestore-reads loop if p99 > 20s or a new 5xx regime appears.
  • Rollback: same literal at 25 (or 5) — revert this PR or re-render the literal in the same env JSON.

Deploy

Config-only; needs the merged SHA on a Cloud Run backend train (lead-owned). At 100 the per-uid sha256 bucket covers the whole fleet. Rollback = literal back to 25/5.

Product invariants affected

  • INV-MEM-4 (product/invariants/memory-promotion-authority.md): Canonical promotion is the sole Long-term authority. All new canonical intake starts in Short-term, one consolidation decision gives every pending item exactly one terminal route, and only an atomically receipted, graph-backed promotion may admit an item to Long-term. Default access collapses canonical lineage, while keyword, vector, compatibility, and shared-graph projections remain retryable derived views.

This change is in the invariant's path globs only via backend/deploy/runtime_env.yaml; it raises a read-path rollout percentage for the bounded index-window list scan (memory_list_index_window 25 -> 100). It creates no intake route, no promotion pass, no second visibility authority, and no projection-state treatment — the window read applies the unchanged row policy and merge rules per backend/docs/runbooks/list-read-serving.md.

Failure-Class

Failure-Class: none

Mobile clients load the Memories page with a 10s read budget
(ReadRetry.callerWindow, app/lib/backend/http/read_retry.dart). The
25% step (68e9422) served 48.5h (2026-10-22T17:25Z..10-24T17:55Z,
full Cloud Logging census: 11,761 list-endpoint 200s vs 6,396 in the
24.1h pre-roll window) with p99 17.33s -> 16.28s, p95/p50 stable,
5xx 431 -> 20 per window (~10/24h vs 433/24h baseline), >24s walks
-35%, slow-small-body truncation proxy flat (17.9 -> 17.3/24h), and
PostHog Product Error error_kind=memories_fetch flat-to-down (11, 12,
10, 6 daily). lever=25 verified in the frozen env of all 8 revisions
that served the soak window. Complete the ramp to 100% per PR
#23310's ramp plan; all other 15 keys unchanged at their current main
values. Rollback is the same literal at 25.

set_levers.py-style replace-mode edit, complete 16-key literal;
contract tests green per-file (test_render_backend_runtime_env 93,
test_verify_pusher_config_references 28, test_check_cloud_run_env_drift
4, test_backend_runtime_env_validator 146: 271 passed).

Loop: firestore-reads; post-100 verification checkpoint 2026-10-29
(48h after the 100% train serves).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T19:30:54.759893Z c606c67 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Git-on-my-level
Git-on-my-level marked this pull request as draft November 4, 2026 07:01
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review November 4, 2026 07:27

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 9 files

Confidence score: 3/5

  • prod_omi_backend_listen_values.yaml raises exposure from 25% to 100% even though the soak covered only 25% and the 67.4 s outlier against the 20 s p99 escalation threshold is unexplained. Keep the rollout at 25% until that outlier is understood.
  • _base.yaml can make existing continuation tokens issued outside the 25% cohort restart at page one because they lack index_window_cursor. Handle those legacy tokens without restarting pagination.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="backend/charts/backend-listen/prod_omi_backend_listen_values.yaml">

<violation number="1" location="backend/charts/backend-listen/prod_omi_backend_listen_values.yaml:220">
P2: This moves `memory_list_index_window` straight from 25% to 100%, which quadruples exposure to the new list-read path. The soak only covered 25%, and the 67.4 s outlier is still unexplained against a 20 s p99 escalation threshold. Consider stepping to an intermediate value (for example 50) and confirming the outlier is resolved before going to 100.</violation>
</file>

<file name="backend/deploy/runtime_env/_base.yaml">

<violation number="1" location="backend/deploy/runtime_env/_base.yaml:34">
P2: This rollout makes some existing continuation tokens restart at page one. Tokens issued while a user was outside the 25% cohort lack `index_window_cursor`, but the 100% path rejects them and `get_memories` silently clears the cursor before returning the first page, causing duplicate pagination results. Preserve a legacy-cursor resume path or add explicit compatibility handling before enabling the gate globally.</violation>
</file>

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

View guided diff | Turn on auto-fix | Re-trigger cubic

value: "1"
- name: FIRESTORE_READ_LEVERS
value: '{"action_items_page":100,"backfill_task_reads":100,"candidates_page":100,"canonical_statuses_dedupe":100,"deletion_marker_cache":100,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":25,"people_scan_dedupe":0,"queue_age_sample_budget":0,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"usage_month_cache":100}'
value: '{"action_items_page":100,"backfill_task_reads":100,"candidates_page":100,"canonical_statuses_dedupe":100,"deletion_marker_cache":100,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":100,"people_scan_dedupe":0,"queue_age_sample_budget":0,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"usage_month_cache":100}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This moves memory_list_index_window straight from 25% to 100%, which quadruples exposure to the new list-read path. The soak only covered 25%, and the 67.4 s outlier is still unexplained against a 20 s p99 escalation threshold. Consider stepping to an intermediate value (for example 50) and confirming the outlier is resolved before going to 100.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/charts/backend-listen/prod_omi_backend_listen_values.yaml, line 220:

<comment>This moves `memory_list_index_window` straight from 25% to 100%, which quadruples exposure to the new list-read path. The soak only covered 25%, and the 67.4 s outlier is still unexplained against a 20 s p99 escalation threshold. Consider stepping to an intermediate value (for example 50) and confirming the outlier is resolved before going to 100.</comment>

<file context>
@@ -217,7 +217,7 @@ env:
     value: "1"
   - name: FIRESTORE_READ_LEVERS
-    value: '{"action_items_page":100,"backfill_task_reads":100,"candidates_page":100,"canonical_statuses_dedupe":100,"deletion_marker_cache":100,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":25,"people_scan_dedupe":0,"queue_age_sample_budget":0,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"usage_month_cache":100}'
+    value: '{"action_items_page":100,"backfill_task_reads":100,"candidates_page":100,"canonical_statuses_dedupe":100,"deletion_marker_cache":100,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":100,"people_scan_dedupe":0,"queue_age_sample_budget":0,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"usage_month_cache":100}'
   - name: FSR_QUEUE_AGE_PUBLISHER
     value: "1"
</file context>

SYNC_POLL_BACKOFF_ENABLED: {value: 'false', category: rollout}
FIRESTORE_READ_LEVERS:
value: '{"action_items_page":100,"backfill_task_reads":100,"candidates_page":100,"canonical_statuses_dedupe":100,"deletion_marker_cache":100,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":25,"people_scan_dedupe":0,"queue_age_sample_budget":0,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"usage_month_cache":100}'
value: '{"action_items_page":100,"backfill_task_reads":100,"candidates_page":100,"canonical_statuses_dedupe":100,"deletion_marker_cache":100,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":100,"people_scan_dedupe":0,"queue_age_sample_budget":0,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"usage_month_cache":100}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This rollout makes some existing continuation tokens restart at page one. Tokens issued while a user was outside the 25% cohort lack index_window_cursor, but the 100% path rejects them and get_memories silently clears the cursor before returning the first page, causing duplicate pagination results. Preserve a legacy-cursor resume path or add explicit compatibility handling before enabling the gate globally.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/deploy/runtime_env/_base.yaml, line 34:

<comment>This rollout makes some existing continuation tokens restart at page one. Tokens issued while a user was outside the 25% cohort lack `index_window_cursor`, but the 100% path rejects them and `get_memories` silently clears the cursor before returning the first page, causing duplicate pagination results. Preserve a legacy-cursor resume path or add explicit compatibility handling before enabling the gate globally.</comment>

<file context>
@@ -31,7 +31,7 @@ environment_shared:
         SYNC_POLL_BACKOFF_ENABLED: {value: 'false', category: rollout}
         FIRESTORE_READ_LEVERS:
-          value: '{"action_items_page":100,"backfill_task_reads":100,"candidates_page":100,"canonical_statuses_dedupe":100,"deletion_marker_cache":100,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":25,"people_scan_dedupe":0,"queue_age_sample_budget":0,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"usage_month_cache":100}'
+          value: '{"action_items_page":100,"backfill_task_reads":100,"candidates_page":100,"canonical_statuses_dedupe":100,"deletion_marker_cache":100,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":100,"people_scan_dedupe":0,"queue_age_sample_budget":0,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"usage_month_cache":100}'
           category: rollout
         FSR_QUEUE_AGE_PUBLISHER:
</file context>

Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
…; memory_list_index_window 25 (#24639)

## What

Config only, one batched lever change:

| Key | Change | Why |
|---|---|---|
| `FSR_SUBSCRIPTION_TTL_SECONDS` | 60 -> 55 (all services) |
cl2-replay's verified privacy replay (1,049 faulted transitions,
2026-11-04 20:12Z) found that, with both invalidations lost, the Redis
`EX 60` subscription/BYOK entry is still served at exactly +60.000s: 37
mismatches at 0s margin. 55s gives 0 with 5s margin. |
| `action_items_ttl120` | 0 -> 5 | Ordinary lever from #24624: the
version-bumped action-item page cache reuses pages for at least 120s
instead of the deployed 30s. |
| `memory_list_index_window` | 0 -> 25 | Back to the cohort that soaked
48h clean (#23536). The #24596/#24601 revert objected to the 0->100
jump, not the lever. |
| `backend/docs/runbooks/external-list-reads.md` | wording | States the
live 5% polling-cache cohort from #24623 (Luna r1 minor on #24623). |

Luna r1 removed `lifecycle_record_pending_head` from this change: it
cohorts on a single namespace key, so 5% would be off on every replica.
A follow-up keys it per replica.

This also satisfies lead2's enforce requirement for #24622
(`1104-b059ba`): the subscription TTL becomes 55s. The new privacy
caches already use a strict `< 60.000s` bound.

## Rollout

David's 2026-11-04 policy for ordinary read levers: 5% for 1-2h with the
firestore-reads 5xx/latency guards, then 100% the same day in a
follow-up. Rollback: set any key back to its previous value.

## Verification

- `pytest tests/unit/test_render_backend_runtime_env.py
tests/unit/test_verify_pusher_config_references.py
tests/unit/test_firestore_read_levers.py
tests/unit/test_backend_runtime_env_validator.py`: 294 passed.
- `pytest tests/unit/test_fsr_s4_caches.py`: passes (TTL ceiling 60
unchanged; 55 is within it).
- Local push gate ran with `BACKEND_UNIT_FILE_BUDGET_SECONDS=900` (host
load ~50); CI keeps its own 300s budget.

## Product invariants affected

- INV-MEM-4 (path match on `backend/deploy/runtime_env.yaml` only; no
memory promotion behavior changes)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
…ist_index_window -> 100; record_pending_head 5% (#24648)

## What

Config only. Ordinary read levers from 5% to 100% after their soak, plus
one new 5% canary:

| Key | Change | Serving at the lower step since |
|---|---|---|
| `OMI_EXTERNAL_LIST_POLLING_CACHE_PERCENT` (Cloud Run backend) | 5 ->
100 | 2026-11-04 20:52Z (#24623) |
| `action_items_ttl120` | 5 -> 100 | 22:13Z (#24639) |
| `memory_list_index_window` | 25 -> 100 | 22:13Z (#24639; 48h clean at
25 earlier, #23536) |
| `lifecycle_record_pending_head` | 0 -> 5 | new canary; per-replica
cohort since #24640 |

## Why

These follow David's 2026-11-04 soak policy for ordinary read levers:
1-2h at 5% with the 5xx/latency guards, then 100% the same day.

Guard evidence comes from the firestore-reads 23:00Z tick, window 22Z.
The `backend` service, where these levers act, had 725 5xx out of 1.24M
requests (0.06%), against 425 out of 700k (0.06%) the previous week, so
it's clean. The tick's overall FAIL is the known `backend-sync` false
positive: `measure.py`'s `sync_local_files` exclusion count got HTTP 429
from Logging, so the lead-ruled `/v2/sync-local-files` 503 wave went
unsubtracted. That disposal is recorded in
`data/run-2026-11-04-infracost/guard-5xx-attrib-2026-11-04T22Z.md` in
omi-workspace. `backend-integration` 5xx since 22:00Z are MCP SSE/list
timeouts and enrichment 500s; they predate the 22:13Z serve and sit on
paths these levers don't touch.

## Rollout

Next Cloud Run train, plus the listen/pusher legs for the shared
literal. Rollback: previous values.

## Verification

`pytest tests/unit/test_render_backend_runtime_env.py
tests/unit/test_verify_pusher_config_references.py
tests/unit/test_backend_runtime_env_validator.py
tests/unit/test_firestore_read_levers.py`: 294 passed. Local push gate
ran with `BACKEND_UNIT_FILE_BUDGET_SECONDS=900`; CI keeps its own 300s.

## Product invariants affected

- INV-MEM-4 (path match on `backend/deploy/runtime_env.yaml` only; no
memory promotion behavior changes)

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24648?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/24648?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24648&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Closing as superseded: origin/main already has memory_list_index_window = 100. The ramp landed via commit 38033d9 (config(firestore-reads): polling cache 5 -> 100, action_items_ttl120 5 -> 100, memory_list_index_window 25 -> 100, 2026-11-05), following the 25% soak served through #24639. All nine files this PR touches (backend-listen/pusher chart values, backend/deploy/runtime_env.yaml, runtime_env/_base.yaml, feature-flag-registry.md, and the two contract-test expectations) already carry the 100 literal on main, and the protected #24786 read-budget tests are green there. This PR's head (c606c67) predates that landing and now conflicts; no further action needed. Rollback path (same literal back at 25) remains as documented in the PR body.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Hey @Git-on-my-level 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

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