Repository navigation
fix(flow): coordinate agent sessions and answer replays - #59
Open
google-labs-stitch[bot] wants to merge 4 commits into
Open
google-labs-stitch[bot] wants to merge 4 commits into
google-labs-stitch[bot] wants to merge 4 commits into
Conversation
- Report disconnected server turns as in progress and hydrate failures - Track draft sessions in Rust and purge deleted or failed sessions - Wait for user profile query settlement before send checks - Reconcile turn media status and errors against live project tiles - Parse memory blocks and preserve non-failed media turn completion - Expose one question card at a time and replay dropped answers
- Keep create_session drafts and queue locks on post-send errors - Release the state lock before agentBusy and agentReplay calls - Preserve unsaved local turns when stored turns lag in loadStoredTurns - Clear only verified turn-store session signals in adaptAgentWire - Accept respond calls when the turn ends immediately after submission - Handle CDP errors in purge_session_state and hold_while_active - Combine question and permission checks into isActionAccepted
- Resolve Agent attachment and composer binding merge conflicts - Add session signals and stream subscription for build 20261129.06 - Read upsampled video variants from verified build descriptors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #40 on current
mainwith support for Google Flow front end buildsboq_labs-ai-sandbox-frontend_20261120.00_p0andboq_labs-ai-sandbox-frontend_20261129.06_p0.Summary
This change coordinates Flow Agent session state, turn hydration, media status reconciliation, and elicitation answer replay across the Rust runtime (
src/agent.rs) and TypeScript browser helpers (ts/):ts/agent_turns.ts,ts/agent_chat.ts): Onmain,getAgentSessionturns withSTORED_TURN_IN_PROGRESSand no open stream report terminal statuses or lose partial local blocks, andloadStoredTurnsskips hydration when counts match after a local failure. This change reportsin_progresswithconnected: false, keeps richer partial blocks fromlocal.Vhwhile clearing transient disconnect errors, and re-hydrates inloadStoredTurnswhenturns.length > localTurns.lengthor local turns contain unpersisted non-stopped failures while preserving unsaved trailing local turns when server persistence lags.src/agent.rs,ts/agent_chat.ts,ts/agent_wire.ts,ts/frontend_builds.ts,ts/frontend_nov29_agent.ts,ts/agent_protocol.ts,ts/index.ts,ts/types.ts): Onmain, unpersisted draft sessions are invisible toget_session,delete_sessionleaves stale entries in local transport and TanStack Query caches, and acreate_sessiontimeout drops theJobQueueexecution guard while Flow continues generating. This change tracks allocated draft IDs inAgentState.drafts, syncs persisted sessions onlist_sessionsandget_session, retains the draft and spawnshold_while_activewith theJobQueuelock whencreate_sessionencounters a CDP error/timeout or post-submissionoutcome_unknown/agent_submission_not_observed, and purges local transport entries (transport.ka.yL), verified turn-storesessionSignals(["oa", "ka"]onboq_labs-ai-sandbox-frontend_20261120.00_p0and["ta", "ka"]onboq_labs-ai-sandbox-frontend_20261129.06_p0via own property descriptors), and TanStack Query cache entries (CREATION_AGENT_SESSION,CREATION_AGENT_SESSIONS) viaagentPurgeondelete_sessionand pre-submission or unpersisted terminalcreate_sessionfailures.ts/agent_chat.ts,ts/agent_settings.ts): Onmain,canSendReadyreturnsagent_not_readyon cold page loads while["USER_PROFILE"]is still settling after["PROJECT_DETAILS", projectId]. This change waits for["USER_PROFILE"]query settlement (with prefix query fallback and a post-settlement tick flush) whenbound.canSend()(composer[canSendField]) remainsfalse.ts/agent_turns.ts,ts/agent_attachments.ts,ts/frontend_builds.ts,ts/frontend_nov29_upload.ts): Onmain, legacy_.yjbtool results omit status fields andturn.Tf.Bxkeeps stalePENDINGorGENERATINGstatuses after project tiles finish or fail. This change parsesstatus,error_code, anderroron legacy tool results and reconciles turn media items against live project tile variants (readAgentProjectTiles,resolveRequestedAsset,isReadyVariant), reading upsampled video variants from verified build descriptors (ynonboq_labs-ai-sandbox-frontend_20261120.00_p0andboonboq_labs-ai-sandbox-frontend_20261129.06_p0).ts/agent_protocol.ts,ts/agent_turns.ts): Onmain,view_agent_memorytool calls drop from turn blocks and turns that produceview_agent_memoryblocks or non-failed media items misclassify an unanswered elicitation card asagent_elicitation_expired. This change emits{ type: "view_agent_memory" }blocks and countsview_agent_memoryblocks and non-failed media items as productive turn output inexpiredElicitationError.src/agent.rs,ts/agent_turns.ts,ts/agent_chat.ts,ts/agent_wire.ts,ts/frontend_nov29_agent.ts): Onmain,pendingActionsexposes all unanswered question cards at once,respondfails when an answer completes a turn immediately or when a live stream drops before re-emitting an unanswered card on reconnect, andhold_while_activeholds theAgentStatemutex across CDP polls. This change exposes only the first unanswered question card inpendingActions, checks card acceptance withisActionAcceptedandisActionStillUnaccepted(reading verifiedstreamSubscription:Wjonboq_labs-ai-sandbox-frontend_20261120.00_p0andAkonboq_labs-ai-sandbox-frontend_20261129.06_p0), records question answers (PendingAnswer) inAgentState.answersfor replay viaagentReplay, releases theAgentStatemutex beforeagentBusyandagentReplayCDP calls, and handles CDP errors explicitly inpurge_session_stateandhold_while_active.Verification
boq_labs-ai-sandbox-frontend_20261120.00_p0boq_labs-ai-sandbox-frontend_20261129.06_p0cargo xtask ci(formatting, license headers, 800-code-line ceiling, doc examples, forbidden constructs,tsc --noEmit,flowcontracts,clippy -D warnings,rustdoc, debug build, andcargo deny).RUSTFLAGS="-D warnings" cargo build --release --locked --bin flow-mcp,cargo xtask collect-licenses, andcargo deny --locked --workspace check.flow-mcp --headless doctor --json(flow-build: okonboq_labs-ai-sandbox-frontend_20261129.06_p0).boq_labs-ai-sandbox-frontend_20261120.00_p0andboq_labs-ai-sandbox-frontend_20261129.06_p0workspaces.