Skip to content

config(external-list): admit 5% of developer API keys to the adaptive polling cache - #24623

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/cl2-pollcache
Nov 4, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/cl2-pollcache

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

What

Config only. This turns on the adaptive developer-API polling cache from #24413 (merged dark 11-02) for 5% of API keys on the Cloud Run backend service:

  • OMI_EXTERNAL_LIST_POLLING_CACHE_ENABLED=true
  • OMI_EXTERNAL_LIST_POLLING_CACHE_PERCENT=5

Behavior is per backend/docs/runbooks/external-list-reads.md. Only repeated identical Developer conversation/memory list queries from fast pollers get the disclosed X-Omi-List-Cache: fast-poller; max-age=N reuse (60/120/300s). Cursor requests and MCP keep their original freshness, and grants, scope and rate limits still run before every lookup.

Why

The /v1/dev/user/conversations origin is about 0.45M reads/h (firestore-reads snapshot 2026-11-04 16Z, coverage 0.70). This is part of David's 2026-11-04 12-hour Firestore savings. config/feature-flags.yaml names infracost (now cl2-infracost) as expander with a 2026-11-05 decision date.

Rollout

5% of API keys under the ordinary-lever policy (1-2h with guards), then 100% in a follow-up. Rollback: ENABLED=false or PERCENT=0, or the global OMI_EXTERNAL_LIST_CACHE_ENABLED=false.

Verification

  • pytest tests/unit/test_render_backend_runtime_env.py tests/unit/test_backend_runtime_env_validator.py tests/unit/test_runtime_env_manifest_compat.py tests/unit/test_external_*: all pass. The offline Cloud Run state fixture gains the two declared envs.
  • Local push gate ran with BACKEND_UNIT_FILE_BUDGET_SECONDS=900 because this host was at load ~50 and test_firestore_query_shapes.py needed 202s just for fixture setup (it passes 544/544 when run directly). 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

View guided diff Turn on auto-fix

… polling cache

Sets OMI_EXTERNAL_LIST_POLLING_CACHE_ENABLED=true and _PERCENT=5 on the Cloud
Run backend service (merged dark in #24413; owner infracost, decision due
2026-11-05 per config/feature-flags.yaml). Repeated identical developer
conversation/memory list polls get the disclosed 60/120/300s reuse; cursor
requests and MCP stay on their original path. Rollback: ENABLED=false or
PERCENT=0 (or the global OMI_EXTERNAL_LIST_CACHE_ENABLED=false).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 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-11-04T18:47:42.913850Z 8e03ad8 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.

@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.

1 issue found across 5 files

Confidence score: 4/5

  • test_backend_runtime_env_validator.py injects these fixture entries into backend-sync and backend-integration even though the rollout is declared only for backend. Scope the insertion to backend to avoid changing the other services' deployed configuration.
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/tests/unit/test_backend_runtime_env_validator.py">

<violation number="1" location="backend/tests/unit/test_backend_runtime_env_validator.py:105">
P2: These fixture entries are injected into `backend-sync` and `backend-integration` as well as `backend`, although the rollout is declared only for `backend`. Scope the insertion to the `backend` service; otherwise deployed-state tests model an impossible configuration and can miss service-specific environment drift.</violation>
</file>

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

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

{"name": "PLAYBACK_ON_DEMAND_ENABLED", "value": "true"},
{"name": "REPEAT_WORK_LLM_VERSION", "value": "2026-10-16-v1"},
{"name": "SYNC_POLL_BACKOFF_ENABLED", "value": "false"},
{"name": "OMI_EXTERNAL_LIST_POLLING_CACHE_ENABLED", "value": "true"},

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: These fixture entries are injected into backend-sync and backend-integration as well as backend, although the rollout is declared only for backend. Scope the insertion to the backend service; otherwise deployed-state tests model an impossible configuration and can miss service-specific environment drift.

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/tests/unit/test_backend_runtime_env_validator.py, line 105:

<comment>These fixture entries are injected into `backend-sync` and `backend-integration` as well as `backend`, although the rollout is declared only for `backend`. Scope the insertion to the `backend` service; otherwise deployed-state tests model an impossible configuration and can miss service-specific environment drift.</comment>

<file context>
@@ -102,6 +102,8 @@ def with_memory_env(payload: str) -> str:
         {"name": "PLAYBACK_ON_DEMAND_ENABLED", "value": "true"},
         {"name": "REPEAT_WORK_LLM_VERSION", "value": "2026-10-16-v1"},
         {"name": "SYNC_POLL_BACKOFF_ENABLED", "value": "false"},
+        {"name": "OMI_EXTERNAL_LIST_POLLING_CACHE_ENABLED", "value": "true"},
+        {"name": "OMI_EXTERNAL_LIST_POLLING_CACHE_PERCENT", "value": "5"},
         {"name": "AUDIO_ARCHIVE_LIVE_ENABLED", "value": "true"},
</file context>

@Git-on-my-level
Git-on-my-level merged commit b9ef1e3 into main Nov 4, 2026
66 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/cl2-pollcache branch November 4, 2026 18:59
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. -->
kriegcloud pushed a commit to kriegcloud/omi that referenced this pull request Nov 5, 2026
…che runbook states the live 5% cohort

- FSR_SUBSCRIPTION_TTL_SECONDS 60 -> 55 on every service. cl2-replay's verified
  replay (1,049 faulted transitions, 2026-11-04 20:12Z) found that, with both
  invalidations lost, the Redis EX 60 entry is still served at exactly +60.000s:
  37 mismatches at 0s margin. 55s gives 0 with 5s margin.
- external-list-reads.md no longer says no deployment values change; BasedHardware#24623
  enabled the adaptive polling cache for 5% of API keys (Luna r1 minor on BasedHardware#24623).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kriegcloud pushed a commit to kriegcloud/omi that referenced this pull request Nov 5, 2026
…5 -> 100, memory_list_index_window 25 -> 100, lifecycle_record_pending_head 0 -> 5

Ordinary read levers under David's 2026-11-04 policy (1-2h at 5% with guards, then
100% the same day): the polling cache has been at 5% since 20:52Z (BasedHardware#24623) and
action_items_ttl120 / memory_list_index_window at 5/25 since 22:13Z (BasedHardware#24639).
lifecycle_record_pending_head starts its 5% canary now that it cohorts per replica
(BasedHardware#24640). Rollback: previous values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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