Repository navigation
fix(flow): coordinate agent sessions and answer replays - #40
google-labs-stitch[bot] wants to merge 2 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
byteland-app
left a comment
There was a problem hiding this comment.
hold_while_active calls agentReplay on every busy poll and ignores its return value. agentReplay sends again whenever the local question still appears pending, which can happen before remote acknowledgement or after a stale reconnect. Separate read-only turn recovery from answer replay. For replay, keep the session, turn, and action identity pinned and use an authoritative acknowledgement or an idempotent write. Check that a delayed acknowledgement and repeated reconnect cannot send the same answer twice. Acquire the execution lock before sending a response that resumes the turn. The current Rust path sends first and ignores lock contention afterward.
|
Changes requested.
This PR also changes |
- 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
|
Addressed all six review items in commit
Also verified 3-way merge compatibility of |
|
Closing this pull request. It conflicts with |
|
Opened #59 against current |
Summary
Coordinate 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): Reportin_progresswithconnected: falsewhengetAgentSessionreturnsSTORED_TURN_IN_PROGRESSwithout a live stream, keep richer partial blocks fromlocal.Vhwhile clearing transient disconnect errors, and re-hydrate inloadStoredTurnsonly whenturns.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): Track allocated draft IDs inAgentState.drafts, sync persisted sessions onlist_sessionsandget_session, keep drafts unpurged and spawnhold_while_activewith theJobQueuelock whencreate_sessionencounters a CDP error/timeout or post-submissionoutcome_unknown/agent_submission_not_observed, and purge local transport entries (transport.ka.yL), verified turn-storesessionSignals(["oa", "ka"]on20261120.00_p0and["ta", "ka"]on20261129.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): Wait for["USER_PROFILE"]query settlement incanSendReadywhenbound.canSend()staysfalseafter["PROJECT_DETAILS", projectId], with prefix query fallback and a post-settlement tick flush.ts/agent_turns.ts,ts/agent_attachments.ts,ts/frontend_builds.ts,ts/frontend_nov29_upload.ts): Parsestatus,error_code, anderroron legacy_.yjbtool result structs and reconcileturn.Tf.Bxand legacy media items against live project tile variants (readAgentProjectTiles,resolveRequestedAsset,isReadyVariant), reading upsampled video variants from verified build descriptors (ynon20261120.00_p0,boon20261129.06_p0).ts/agent_protocol.ts,ts/agent_turns.ts): Emit{ type: "view_agent_memory" }blocks forview_agent_memorytool calls and treatview_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): Expose only the first unanswered question card inpendingActions, verify card acceptance throughisActionAcceptedandisActionStillUnaccepted(with verifiedstreamSubscription:Wjon20261120.00_p0,Akon20261129.06_p0) sorespondsucceeds when a turn finishes immediately upon submission, record question answers (PendingAnswer) inAgentState.answers, release theAgentStatemutex beforeagentBusyandagentReplayCDP calls inhold_while_active, and handle CDP errors explicitly inpurge_session_stateandhold_while_active.Verification
cargo xtask ci(formatting, license headers, 800-code-line limit, doc examples, forbidden constructs,tsc --noEmit,flowcontracts,clippy,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).20261120.00_p0and20261129.06_p0workspaces.