Skip to content

fix(flow): bind edit composers and exclude non-composer panels across builds - #43

Open
google-labs-stitch[bot] wants to merge 6 commits into
mainfrom
stitch/guard-edit-composers-routes-history-jm0-326e17c2-d6fd-483d-aca5-f017032cc910
Open

google-labs-stitch[bot] wants to merge 6 commits into
mainfrom
stitch/guard-edit-composers-routes-history-jm0-326e17c2-d6fd-483d-aca5-f017032cc910

Conversation

@google-labs-stitch

@google-labs-stitch google-labs-stitch Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Bind flow-edit-image-prompt-box, exclude non-composer panels across routes, wire verified PromptComposerFormat fields through ts/frontend_builds.ts, ts/frontend_recent.ts, ts/frontend_nov29.ts, and ts/frontend_dec02.ts, fail explicitly when no edit prompt box opens, and detect re-failures on already-failed primaries without waiting 420 seconds (scene-clip timeline selection is split out for a separate pull request):

  • Verified PromptComposerFormat in ts/frontend_builds.ts, ts/frontend_recent.ts, ts/frontend_nov29.ts, and ts/frontend_dec02.ts: Remove kf from ts/prompt_writer.ts and ts/types.ts. Define PromptComposerFormat (LEGACY_PROMPT_COMPOSER, NOVEMBER_20_PROMPT_COMPOSER, NOVEMBER_29_PROMPT_COMPOSER for boq_labs-ai-sandbox-frontend_20261129.06_p0, and DECEMBER_02_PROMPT_COMPOSER for boq_labs-ai-sandbox-frontend_20261202.00_p0: Oa, hp, Nf, Be, If, Xhb, dN, Mh, tf, Td, submit, kQ, ZQ, UZ, dAa, yA, Kw, rl, Dp), and read composer fields through promptComposerFormat() across composer.ts, prompt_writer.ts, setup_generation.ts, attach_ingredients.ts, submit_generation.ts, and video_ops.ts.
  • Bind flow-edit-image-prompt-box and exclude non-composer panels: Include flow-edit-image-prompt-box alongside flow-edit-video-prompt-box in textbox lookup, BasePromptBoxInstance resolution, writePromptBox seeds, settings dismissal, warning checks, and submit button targeting. Exclude verified non-composer panels (flow-agent-panel, .agent-panel-wrapper, flow-creative-agent-prompt-box, flow-applet-chat-sidebar, flow-applet-prompt-box, flow-editor-side-panel, flow-editor-history-panel, flow-comments-panel, .embedded-comments-panel, flow-comment-region-overlay, flow-comment-timeline-lane) on every route.
  • Explicit no-textbox failure, scene duration compatibility, and src/edit.rs extraction: Move EditParams, check_open_edit_errors, and run_edit to src/edit.rs. Keep main support for scene tiles with a duration (target.duration.is_some() / hasTileDuration), reject durationless scene, character (pointing to flow_character_edit), and audio, surface .too-long-overlay / [role="alert"] / flow-alert-dialog banners, and fail with an error instead of downloading the image and spending credits on a workspace generation when has_textbox is false.
  • Fast re-failure detection in wait_for_new_assets: Track watched_restarted, stalled_failed_polls, and baseline primary_media_id, prev_media_error, and prev_created_at so an already-failed primary that fails again exits promptly instead of waiting 420 s.
  • Split out scene-clip selection and tile.history scanning: Restore ts/scene_tiles.ts, ts/read_store_snapshot.ts, src/assets.rs, and src/characters.rs to main for a separate pull request.

Verification

  • Passed cargo xtask ci (cargo fmt --all -- --check, cargo xtask check, tsc --noEmit, esbuild, cargo clippy --locked --workspace --all-targets -- -D warnings, cargo doc --locked --workspace --no-deps --document-private-items, cargo build --locked --workspace, and cargo deny --locked --workspace check).
  • Verified runtime behavior in headless Chrome (google-chrome --headless=new) against both boq_labs-ai-sandbox-frontend_20261129.06_p0 and boq_labs-ai-sandbox-frontend_20261202.00_p0:
    • Disabled submit reason reads UZ() / Oa.If.Xhb() (20261202.00_p0) and XX() / Oa.Ff.hdb() (20261129.06_p0).
    • attachIngredients and submitGeneration bind flow-edit-image-prompt-box via dN -> Mh -> tf -> Td (kQ() === true on 20261202.00_p0) and RL -> Ah -> df -> Nd (NO() === true on 20261129.06_p0), and ignore flow-agent-panel, flow-comments-panel, flow-editor-side-panel, and flow-editor-history-panel decoys.
    • Workspace manual composer switches Agent to Manual via yA / rl / Kw / Dp, sets output count via dAa(4), and closes ZQ on 20261202.00_p0.
  • Verified MCP stdio (23 tools, unchanged EditParams) and live Google Flow compatibility (flow-mcp --headless doctor --json -> Verified Google Flow build (boq_labs-ai-sandbox-frontend_20261202.00_p0)).

Headless Chrome verification on Flow build 20261129.06_p0

- Bind image edit prompt boxes and exclude non-composer panels
- Include kf segments in fallback PromptState document updates
- Route scene clips to /scene/, check alerts, and reject scenes
- Track latest_variant_id in history while keeping primary URLs

@byteland-app byteland-app left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

selectSceneClip falls back to the first visible clip if it cannot match the requested ID. The caller then reports opened: true as soon as any edit composer appears. The edit can target a different clip. Require a matching clip ID and check the selected clip after selection. Return a selection error when you cannot prove the match. Verify a two-clip timeline where the requested clip is absent or has not loaded.

- Require an unambiguous clip ID match without first-clip fallback
- Reject unloaded or placeholder clips in scene timelines
- Verify selected clip state in DOM and Angular component inputs
- Return a selection error when the editor cannot prove the match
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed in 89a4670:

  • Removed first-clip and positional fallbacks (ts/scene_tiles.ts, ts/open_edit_asset.ts): selectSceneClip now requires an unambiguous clip ID match (workflowId, clipId, primaryMediaId, or mediaId across DOM attributes and Angular LView / @for repeater context slots) and never falls back to clipIndex, mediaUrl, or the first visible clip.
  • Rejected unloaded or placeholder clips (ts/scene_tiles.ts): Clips with PLACEHOLDER_ / extend-failed- IDs, .pending-placeholder, .processing-shimmer, aria-busy="true", type: "generating", or isClipLoading: true on flow-edit-video-prompt-box are partitioned out of selectable matches and return scene_clip_not_loaded.
  • Verified selected clip after selection & surfaced selection errors (ts/scene_tiles.ts, ts/open_edit_asset.ts, src/generation.rs): Both selectSceneClip and openEditAsset run verifySelectedSceneClipInBuilder after clicking and after composer readiness polling to check timeline DOM selection state (.selected / aria-selected="true" without .unselected-mask, with no other timeline clip selected) and Angular component inputs (selectedClip, selectedClipMediaId, isClipLoading, placeholderText, submitDisabledReason). When the match cannot be proven, openEditAsset returns { opened: false, error, selection_error, has_textbox: false } even if another clip's edit composer is open, and run_edit bails out (Flow cannot select clip '<id>': ...) and navigates back to the project root while requiring selected_clip_id == target.id for scene clips.
  • Verified two-clip timelines in headless Chrome: Confirmed on a two-clip flow-scene-timeline (with clip-1 selected and an open edit composer textbox) that requesting an absent clip (clip-3 -> scene_clip_not_found), an unloaded/placeholder clip (clip-2 -> scene_clip_not_loaded), or an unchanged/unverifiable selection (scene_clip_not_selected / scene_clip_selection_mismatch / scene_clip_selection_unverified) all return opened: false with selection_error without editing clip-1, while a loaded clip-2 selects cleanly and returns opened: true, selected_clip_id: "clip-2".

@byteland-app

Copy link
Copy Markdown
Contributor

Changes requested. This PR is the one to keep of the two edit PRs (#43 and #50). I close #50 as a duplicate.

  1. ts/read_store_snapshot.ts (pickLatestHistoryVariant): it reads the time from hc ?? kc ?? lc. These are minified names. Without a time, it takes the last array item, but the old code used hist[0] and ts/types.ts says history is oldest to newest. If Flow sorts newest first, latest_variant_id is the oldest variant, and wait_for_new_assets can judge wrong or wait 420 s.
  2. media_status now comes from the latest variant. A tile with a good primary and a failed latest variant shows failed. This changes the output of flow_assets. Document it or keep the old behavior.
  3. ts/scene_tiles.ts: about 770 new lines depend on unverified minified keys (kN, AC, od, gI, Jc, Pc, Jj, Aa) and wide class and data-* selectors. A new Flow build gives scene_clip_not_found for a selector problem. notReady also excludes failed clips, so a failed clip cannot be edited again.
  4. src/generation.rs (about L650-730): the alert and selection_error handling is copied twice. Move it to one function.
  5. watched.latest_variant_id != w.latest_variant_id is true when one side is None. This can report a false failure for old data without history.
  6. opened_in_ui now needs has_textbox: true. An image edit without a textbox uses the fallback, and ensure_project_workspace_root(...)? can then stop the whole edit.

Rebase after #38 (same history parsing) and #39 are decided. generation.rs is near the 800 line limit.

- Collect failed history variants without timestamp keys or order
- Keep primary media_status and media_error in asset snapshots
- Read timeline clips from declared Angular inputs and store data
- Allow selection of failed clips and report unreadable timelines
- Move run_edit and shared open-edit checks into src/edit.rs
- Keep image edit fallback active if workspace navigation fails
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed all six points in commit 0b1db25:

  1. ts/read_store_snapshot.ts (minified timestamp keys and history sort order): Removed variantTimestampMs (hc ?? kc ?? lc) and pickLatestHistoryVariant. Snapshot extraction now collects failed and canceled variants (collectFailedVariants / mergeFailedVariants) across tile.history and scene history independent of array sort order or timestamp keys, and restores hist[0] as the fallback media entry on scene clips when primaryMediaId is absent.
  2. media_status in flow_assets: Restored media_status, media_error, and populate_missing_media_urls to read only the primary media item, matching main. A tile with a ready primary media item and a failed non-primary history variant keeps media_status: "ready" in flow_assets, while failed_variants stays internal (#[serde(default, skip_serializing)] on FlowAsset).
  3. ts/scene_tiles.ts (minified keys, selector failures, and failed clips): Removed all unverified minified property keys (kN, AC, od, gI, Jc, Pc, Jj, Aa) and wide speculative selectors. Timeline inspection now uses verified store sceneContents, <flow-scene-timeline>'s declared @Input("clips") ({ id, workflowId, mediaId, type }), and <flow-edit-video-prompt-box>'s declared inputs (selectedClip, selectedClipMediaId, isClipLoading, placeholderText, submitDisabledReason). Removed failed and canceled from NOT_READY_CLIP_STATUS so failed primary clips remain selectable and re-editable (only extend-composing and extend-failed-* pills are marked auxiliary), and returned scene_timeline_unreadable instead of scene_clip_not_found when a non-empty scene or timeline yields zero clip elements or zero readable clip IDs.
  4. Duplicate alert / selection_error checks and src/generation.rs line count: Extracted EditParams, check_open_edit_errors (shared helper for alert and selection_error), and run_edit into src/edit.rs, bringing src/generation.rs down to 546 code lines.
  5. Option comparison on legacy data without history: Replaced latest_variant_id inequality checks with set membership against pre-submit failed variant IDs (!w.before_failed_variant_ids.contains(&v.id)) and (Some(cur), Some(prev)) => cur != prev on primary_media_id, preventing None != Some false failures on legacy tiles without history.
  6. Image edit fallback when has_textbox is false: Made ensure_project_workspace_root non-fatal in the !opened_in_ui fallback (if ensure_project_workspace_root(engine).await.is_err() { let _ = ensure_flow_store(engine).await; }), so an image edit without an editor textbox proceeds to the ingredient-based generation fallback instead of aborting.

@byteland-app

Copy link
Copy Markdown
Contributor

I reviewed this pull request on top of current main (build 20261129.06_p0 is now supported). The merge is clean and keeps the main fixes for the prompt state (Oa/rc), the slot field Xd, the validation field Gq, createdIso, and the page class from the build format. I did not merge it, because nothing in it was run against 20261129.06_p0:

  1. ts/prompt_writer.ts:466 adds the build-specific name kf, and ts/types.ts:306 adds kf?. Build-specific names belong in ts/frontend_builds.ts or ts/frontend_nov29*.ts. There is no evidence that kf exists in the current build.
  2. src/edit.rs:104-117 requires has_textbox. If it is false for an image, the code downloads the asset and starts a generation (src/edit.rs:163-185). That spends credits and does not edit the asset. Fail with an error or make the fallback explicit.
  3. src/edit.rs:60-76 rejects every scene tile. main allowed a scene with a duration. Please justify this change.
  4. ts/scene_tiles.ts still depends on many unverified selectors, ID shapes (<id>-<index>, PLACEHOLDER_, extend-failed-), and Angular input names (readComponentInput). Please ground them in build 20261129.06_p0 or cut them.
  5. src/generation.rs:~446-461 can wait the full 420 s when an already-failed primary fails again without a new variant ID.
  6. ts/read_store_snapshot.ts reads tile.history and uses the legacy names Zc and nf for failures. Neither is verified for the current build.

Please split the change: the panel exclusion and image prompt-box binding could land alone. The scene-clip selection can be a second pull request.

- Define PromptComposerFormat for build 20261129.06 and drop kf.
- Bind flow-edit-image-prompt-box and exclude non-composer panels.
- Fail explicitly when no edit textbox opens and keep scene duration.
- Cut scene clip timeline and tile history changes for a second PR.
- Bail fast when a failed primary fails again in wait_for_new_assets.
@google-labs-stitch google-labs-stitch Bot changed the title fix(flow): guard edit composers, routes, and variant history fix(flow): bind edit composers and exclude non-composer panels across builds Dec 1, 2026
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed all six review items and split out the scene-clip / tile.history changes in 77943ac:

  1. kf and build-specific composer names (ts/frontend_builds.ts, ts/frontend_nov29.ts, ts/prompt_writer.ts, ts/types.ts): Removed kf from ts/prompt_writer.ts and ts/types.ts. Added PromptComposerFormat (LEGACY_PROMPT_COMPOSER, NOVEMBER_20_PROMPT_COMPOSER, and NOVEMBER_29_PROMPT_COMPOSER verified against boq_labs-ai-sandbox-frontend_20261129.06_p0: Oa, Ao, vf, ze, Ff, hdb, RL, Ah, df, Nd, submit, NO, DP, XX, zwa, qz, Qv, Kn, Mo) and wired composer.ts, prompt_writer.ts, setup_generation.ts, attach_ingredients.ts, submit_generation.ts, and video_ops.ts through promptComposerFormat().
  2. No silent generation fallback when has_textbox is false (src/edit.rs): Removed the image download + workspace generation fallback when !opened_in_ui. run_edit now returns to the workspace root and fails explicitly with Could not open an edit prompt box for <mode> asset '<label>' for both image and video assets instead of spending credits on a new generation.
  3. Allow scene tiles with a duration (src/edit.rs, ts/open_edit_asset.ts): Restored main compatibility so scene tiles with duration.is_some() (or numeric duration on the tile / primary media container via snapshotFormat()?.media in openEditAsset) open as "video", rejecting scene only when duration is absent.
  4. Split out ts/scene_tiles.ts (ts/scene_tiles.ts, src/characters.rs): Restored ts/scene_tiles.ts and src/characters.rs to main so scene-clip timeline selection can be grounded and reviewed in a separate pull request. Also verified every selector in NON_COMPOSER_PANELS (flow-agent-panel, .agent-panel-wrapper, flow-creative-agent-prompt-box, flow-applet-chat-sidebar, flow-applet-prompt-box, flow-editor-side-panel, flow-editor-history-panel, flow-comments-panel, .embedded-comments-panel, flow-comment-region-overlay, flow-comment-timeline-lane) directly against boq_labs-ai-sandbox-frontend_20261129.06_p0.
  5. Fast bail when an already-failed primary fails again (src/generation.rs): WatchedAsset and wait_for_new_assets now track watched_restarted, stalled_failed_polls, and baseline primary_media_id, prev_media_error, and prev_created_at, bailing immediately when watched transitions out of failed/canceled and fails again, changes primary/error/timestamp, or remains failed across post-submit polls with zero pending tiles instead of waiting 420 s.
  6. Cut tile.history and legacy Zc / nf failure scans (ts/read_store_snapshot.ts, src/assets.rs, ts/types.ts): Restored ts/read_store_snapshot.ts and src/assets.rs to main and removed SnapshotFailedVariant / failed_variants.

Verified with cargo xtask ci, headless Chrome runtime checks against boq_labs-ai-sandbox-frontend_20261129.06_p0, and flow-mcp --headless doctor --json against live Google Flow (boq_labs-ai-sandbox-frontend_20261129.06_p0).

- Merge upstream main through commit d34417e into this branch
- Register recent prompt composer formats in ts/frontend_recent.ts
- Add verified prompt composer fields for Flow build 20261202.00
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