Skip to content

fix(flow): parse rpc error envelopes and workflow history - #58

Open
google-labs-stitch[bot] wants to merge 3 commits into
mainfrom
stitch/parse-rpc-errors-and-workflow-history-jm1-ab58bba7-0156-4f9d-a8dc-b4a0df7d95a1
Open

google-labs-stitch[bot] wants to merge 3 commits into
mainfrom
stitch/parse-rpc-errors-and-workflow-history-jm1-ab58bba7-0156-4f9d-a8dc-b4a0df7d95a1

Conversation

@google-labs-stitch

Copy link
Copy Markdown
Contributor

Summary

Supersedes #38 on current main (v2.4.0, Google Flow build boq_labs-ai-sandbox-frontend_20261129.06_p0).

On current main, src/cdp.rs fetches response bodies on every HTTP >= 400 response from Flow hosts and skips HTTP 200 batchexecute wrb.fr and er error envelopes, while ts/read_store_snapshot.ts ignores tile.history (where _.BN records failed edit variants while keeping primaryMediaId and Mb unchanged) and reads only hist[0] on scene Xg maps while letting failed scene variants overwrite existing.media_status.

This pull request scopes CDP response body reads to active generation RPCs, parses batchexecute JSPB error frames, and tracks workflow history failures across tile.history and scene Xg history without overriding primary media_status or url.

Changes

  • Scope CDP body reads and parse batchexecute JSPB error envelopes (src/cdp.rs, src/engine.rs, src/generation.rs):
    • Derive flow.google.com from FLOW_URL in is_flow_api_host alongside labs.google and aisandbox-pa.googleapis.com.
    • Call Network.getResponseBody only when network_tx.receiver_count() > 0 and the response is a Flow-host POST that matches (status >= 400 && is_generation_rpc_url(url)) || (status == 200 && has_generation_batchexecute_rpc(url)).
    • Match all 16 live generation, extend, upsample, and upload RPC IDs (BATCH_GENERATION_RPC_IDS, adding LcEY2c, SPrCad, sAVZzc, jeNy9c, and maseQ) as exact comma/%2C-separated tokens in /batchexecute rpcids query parameters (has_generation_batchexecute_rpc) and filter wrb.fr frames by exact frame[1] RPC ID (is_generation_rpc_id) so co-batched non-generation RPC errors never fail a generation job.
    • Decode Boq JSPB wrb.fr ([2, 9, 10] payload oneof, extension-pivot object indexing, and google.rpc.Status array on field 5) and er batch error frames (fields 2, 4, 9, 10), ignoring trailing er frames once a generation wrb.fr data frame resolves in the same envelope.
  • Preserve primary media status and align workflow history reads with build 20261129.06_p0 (ts/types.ts, ts/scene_tiles.ts, ts/read_store_snapshot.ts, src/assets.rs):
    • Resolve scene clips and history from VERIFIED_BUILDS (Pc and Xg in 20261129.06_p0, Uc and Cg in 20261120.00_p0, Tc and tg in 20261117.10_p0, plus legacy Oc and Yf), and preserve createdIso (Yb dates without hc URL leakage) and snapshotFormat()?.trim (Kc/Oc and cj/Si/uc).
    • Keep media_status and media_error bound strictly to the tile or clip primary media (primaryStatus || null and primaryError) so an older history[1..] failure never overrides a "pending" or "success" primary media item, while keeping primary_ready and cold-cache as29s URL lookups intact.
    • Key failed_history markers uniquely as id:<cleanId> (or id:<cleanId>#<occ>) and anon:<index> (<key>|<status>|<error>) and deduplicate by <key> in mergeFailedHistory while upgrading empty error text.
  • Detect new history and primary failures against pre-submit baselines (src/scenes.rs, src/generation.rs, src/characters.rs):
    • Compare watched tiles and scene clips against baseline failed_history, media_error, primary_media_id, and media_status (FlowAsset::new_failure, watch_baseline, and clip_entered_error) so pending edits after an older failed variant keep polling normally while newly appended failures stop on the next poll tick.

Verification

  • Passed cargo xtask ci, cargo xtask collect-licenses, cargo deny --locked --workspace check, and flow-mcp --headless doctor --json (Verified Google Flow build (boq_labs-ai-sandbox-frontend_20261129.06_p0)).
  • Verified all 16 BATCH_GENERATION_RPC_IDS, eq.qg = "wrb.fr" (gq = [2, 9, 10], field 5 google.rpc.Status), sC.qg = "er", tile.history, and scene Pc / Xg directly against the live boq_labs-ai-sandbox-frontend_20261129.06_p0 bundle.
  • Verified in headless Chrome against boq_labs-ai-sandbox-frontend_20261129.06_p0 (LQ store, Mb/hc/Yc/Of/Yb media fields, Kc/Oc/cj/Si/uc trim bounds, and Pc/Xg scene history) that pending edits with older failed history keep media_status: "pending", ready primaries preserve URLs and Yb timestamps, empty-ID failures deduplicate across tile.history and scene.Xg, and new failures surface exact upstream error messages.

Verification summary

- Match flow.google.com and parse HTTP 200 batchexecute error frames
- Add LcEY2c, SPrCad, sAVZzc, jeNy9c, and maseQ to generation RPC IDs
- Preserve primary clip URLs when workflow history[1..] items fail
- Track failed history items so video extend aborts on the next poll
- Keep primary media status and error separate from history failures
- Compare watched and scene clip failures against baseline snapshots
- Match generation batchexecute rpcids and wrb.fr frames by exact ID
- Decode JSPB field offsets and google.rpc.Status arrays from wrb.fr
- Read CDP response bodies only for active generation POST responses
- Key failed history markers by unique ID or anonymous index
- Keep createdIso and trim format reads from build 20261129.06
- Resolve scene clips and history from verified build formats
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.

0 participants