Repository navigation
Speed up conversations v3 reconcile and pipeline lab day replay - #26849
Git-on-my-level merged 4 commits into
Conversation
There was a problem hiding this comment.
3 issues found across 12 files
Confidence score: 3/5
- In
barrier.py,settle=0.005can letExecutorBarrier.waitreturn before completion callbacks submit follow-up work, so chain and v3 may export or read state while postprocessing is still running. Retain the 50 ms window or wait for postprocessing to finish. - In the pipeline lab README, the documented concurrency settings leave filesystem storage shared, so concurrent replays can overwrite or read each other’s data. Isolate
<OMI_PIPELINE_LAB_ROOT>/stack/storageper replay. - In
conversations_v3_row_codec.py,decode_rowimportsFIELDandreveal_segmentslocally despite the module-scope import rule. Move them to the module import block.
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/testing/pipeline_lab/README.md">
<violation number="1" location="backend/testing/pipeline_lab/README.md:657">
P2: The documented concurrency settings isolate Firestore and Redis, but not the lab's filesystem storage. Concurrent replays still install the same `<OMI_PIPELINE_LAB_ROOT>/stack/storage` and can overwrite or read each other's local objects; require a distinct lab/storage root per process or namespace storage by project before documenting this as safe.</violation>
</file>
<file name="backend/database/conversations_v3_row_codec.py">
<violation number="1" location="backend/database/conversations_v3_row_codec.py:54">
P3: This new backend production import is inside `decode_row`, contrary to the module-scope import rule. Move `FIELD` and `reveal_segments` to the module import block.</violation>
</file>
<file name="backend/testing/pipeline_lab/chain/barrier.py">
<violation number="1" location="backend/testing/pipeline_lab/chain/barrier.py:98">
P1: `settle=0.005` can let `ExecutorBarrier.wait` return before completion callbacks submit follow-up work. Chain and v3 then export or read state while postprocess work is still running; retain the 50 ms window or wait on a submission-generation/condition until the quiet interval is genuinely complete.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| return len(self._pending) | ||
|
|
||
| def wait(self, timeout: float = 300.0, *, settle: float = 0.05) -> float: | ||
| def wait(self, timeout: float = 300.0, *, settle: float = 0.005) -> float: |
There was a problem hiding this comment.
P1: settle=0.005 can let ExecutorBarrier.wait return before completion callbacks submit follow-up work. Chain and v3 then export or read state while postprocess work is still running; retain the 50 ms window or wait on a submission-generation/condition until the quiet interval is genuinely complete.
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/testing/pipeline_lab/chain/barrier.py, line 98:
<comment>`settle=0.005` can let `ExecutorBarrier.wait` return before completion callbacks submit follow-up work. Chain and v3 then export or read state while postprocess work is still running; retain the 50 ms window or wait on a submission-generation/condition until the quiet interval is genuinely complete.</comment>
<file context>
@@ -95,7 +95,7 @@ def pending(self) -> int:
return len(self._pending)
- def wait(self, timeout: float = 300.0, *, settle: float = 0.05) -> float:
+ def wait(self, timeout: float = 300.0, *, settle: float = 0.005) -> float:
"""Block until no tracked work is pending (stable for ``settle`` seconds)."""
started = time.monotonic()
</file context>
| `OMI_PIPELINE_LAB_PROJECT_ID` (beginning with `demo-`) and | ||
| `OMI_PIPELINE_LAB_REDIS_DB` in each replay process. Both processes can use the | ||
| same Firestore and Redis ports. Each replay resets its lab user's state before | ||
| seeding the day, so reserve each project and database until its replay exits. | ||
| For a base/head timing comparison, launch each command from its own revision's | ||
| `backend/`: the launcher supplies the lab harness and `--ref` selects the | ||
| product code. | ||
|
|
||
| ## Runbook: replay a real day (lead, on the lab host) |
There was a problem hiding this comment.
P2: The documented concurrency settings isolate Firestore and Redis, but not the lab's filesystem storage. Concurrent replays still install the same <OMI_PIPELINE_LAB_ROOT>/stack/storage and can overwrite or read each other's local objects; require a distinct lab/storage root per process or namespace storage by project before documenting this as safe.
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/testing/pipeline_lab/README.md, line 657:
<comment>The documented concurrency settings isolate Firestore and Redis, but not the lab's filesystem storage. Concurrent replays still install the same `<OMI_PIPELINE_LAB_ROOT>/stack/storage` and can overwrite or read each other's local objects; require a distinct lab/storage root per process or namespace storage by project before documenting this as safe.</comment>
<file context>
@@ -653,6 +653,15 @@ FS_PORT=8296 REDIS_PORT=6392 SMOKE_MODULE=testing.pipeline_lab.v3.smoke \
the fake engine; the smoke runs the real product chain against a Firestore emulator.
+For concurrent day replays on one emulator stack, export a different
+`OMI_PIPELINE_LAB_PROJECT_ID` (beginning with `demo-`) and
+`OMI_PIPELINE_LAB_REDIS_DB` in each replay process. Both processes can use the
+same Firestore and Redis ports. Each replay resets its lab user's state before
</file context>
| `OMI_PIPELINE_LAB_PROJECT_ID` (beginning with `demo-`) and | |
| `OMI_PIPELINE_LAB_REDIS_DB` in each replay process. Both processes can use the | |
| same Firestore and Redis ports. Each replay resets its lab user's state before | |
| seeding the day, so reserve each project and database until its replay exits. | |
| For a base/head timing comparison, launch each command from its own revision's | |
| `backend/`: the launcher supplies the lab harness and `--ref` selects the | |
| product code. | |
| ## Runbook: replay a real day (lead, on the lab host) | |
| For concurrent day replays on one emulator stack, export a distinct | |
| `OMI_PIPELINE_LAB_ROOT` (or storage root) as well as a different | |
| `OMI_PIPELINE_LAB_PROJECT_ID` (beginning with `demo-`) and | |
| `OMI_PIPELINE_LAB_REDIS_DB` in each replay process. Both processes can use the | |
| same Firestore and Redis ports. Each replay resets its lab user's state before | |
| seeding the day, so reserve each project, database and storage root until its | |
| replay exits. | |
| For a base/head timing comparison, launch each command from its own revision's | |
| `backend/`: the launcher supplies the lab harness and `--ref` selects the | |
| product code. |
| ): | ||
| # Keep the authenticated, unrevealed JSON for the normal reader. Its timed sidecar and privacy | ||
| # filters must still run on the original segment fields. A strict read also reports rejected sidecars. | ||
| from utils.conversations.speaker_grouping_storage import FIELD, reveal_segments |
There was a problem hiding this comment.
P3: This new backend production import is inside decode_row, contrary to the module-scope import rule. Move FIELD and reveal_segments to the module import block.
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/database/conversations_v3_row_codec.py, line 54:
<comment>This new backend production import is inside `decode_row`, contrary to the module-scope import rule. Move `FIELD` and `reveal_segments` to the module import block.</comment>
<file context>
@@ -13,6 +21,62 @@
+ ):
+ # Keep the authenticated, unrevealed JSON for the normal reader. Its timed sidecar and privacy
+ # filters must still run on the original segment fields. A strict read also reports rejected sidecars.
+ from utils.conversations.speaker_grouping_storage import FIELD, reveal_segments
+
+ segments = conversations.decode_transcript_segments_blob(uid, raw_transcript, True, require_decryption=True)
</file context>
Reduce per-pass CPU in conversations v3 reconcile and speed up full-day lab replay. SCA-6045.
Local checks passed 781 v3 tests and 843 pipeline lab tests. All 26 committed scenarios ran on base and head. Both passed 21 and reported the same five vendor-call budget failures with identical counts and expectations.
First day comparison matched all 40 cards across start, end, visibility, hidden reason, recording count and segment count. All 194 head calls replayed. Paired replay with the matching harness on each arm reduced driver time from 540.1 s to 375.9 s. CI passed all 26 scenarios across both repeats. On the larger day all 38 cards matched across the base recording and both replay arms. Driver time fell from 2013.8 s to 1052.7 s (860 tasks each). Base and head replay each missed one embedding call out of 225. Seven fresh interpreters on the unchanged base reproduced the recorded and replayed request variants from the same input. Hash-dependent tie selection at the 32-term cutoff explains the miss. Artifact comparison found 2 differences among 50 comparisons on the smaller day and 6 among 48 on the larger day. The larger vector file fell from 778,259,292 to 596,568,738 bytes.
Serial head controls matched the concurrent head runs on every card on both days (40 and 38). Both concurrent runs shared one emulator with distinct Firestore projects and Redis databases.
Product invariants affected
none