fix(canvas-sync): mirror voiceCapable+voiceId in pushCanvasStateToCloud#1331
Merged
Merged
Conversation
…StateToCloud
Two node writers POST to /api/hosts/:id/canvas:
- src/cloud.ts:1558 syncCanvas (30s cadence) — sets voiceCapable
via PR #1330 truth seam from agent_config.settings.voice
- src/server.ts:13151 pushCanvasStateToCloud (5s cadence) — sent
only {state, task, displayName, identityColor, avatar}
The cloud POST handler does `payload: agentState as object` (full
replace, not merge). The 5s writer was clobbering voiceCapable/voiceId
set by the 30s syncCanvas. Compass observed flipping voiceCapable
true→false→true on each cycle.
Patch: extend the 5s writer to mirror writer #1's voice derivation
from the same agent_config.settings.voice source. Both writers now
agree on payload shape so the later one preserves what the earlier
set.
Unblocks reflectt-cloud PR #3230 speak V0 proof.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
task-1777140469973-770cy4yma — speak visibility V0 truth-seam follow-up unblocking pushCanvasStateToCloud writer #2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Two node writers POST to
/api/hosts/:id/canvas:src/cloud.ts:1558syncCanvas (~30s cadence) — setsvoiceCapablevia the PR feat(canvas-sync): derive voiceCapable + voiceId from agent_config.settings.voice #1330 truth seam fromagent_config.settings.voicesrc/server.ts:13151pushCanvasStateToCloud (5s cadence) — sent only{state, task, displayName, identityColor, avatar}The cloud POST handler at
apps/api/src/host-canvas-state-routes.ts:89-99writespayload: agentState as object— full replace, not merge. So the 5s writer was clobberingvoiceCapable/voiceIdset by the 30s syncCanvas. Compass on canonical was observed flippingvoiceCapabletrue → false → true on each cycle.Patch
Extend the 5s writer to mirror writer #1's voice derivation from the same
agent_config.settings.voicesource. Both writers now agree on payload shape, so the later writer preserves what the earlier one set.13 lines, one file. Build clean.
Why this and not a cloud-side merge
Cloud-side merge in the POST handler would also fix it, but
(c) every writer sends canonical shapeis the right invariant for now — it stays explicit about the source of truth for each field. Flagged the structural fragility (two writers + full-replace POST) to @kai separately for a follow-up lane.Unblocks
reflectt-cloud PR #3230 — speak visibility V0. Once this merges and canonical rolls, the speak proof spec can prove compass lit / others honestly blocked.
Test plan
npm run buildpasses)/api/hosts/{canonical}/canvasreturnscompass.voiceCapable=true, voiceId='af_sarah'and stays stable across multiple polls (not just first sync)apps/web/e2e/_speak-row-proof.spec.tsagainst PR #3230 Vercel preview — passes 4-bar test