You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
agent-cloud /sync drops non-NULL columns when the first row of a batch has NULLs #10602
The agent VM's /sync endpoint derives the column list for a whole batch from the first row only, while the desktop sender deliberately omits NULL columns per row. When those disagree, rows are written missing columns that the sender did populate — and the desktop still advances its sync cursor, so they are never resent.
case.null:
// skip nulls — let the VM use its defaults
break
Each row's key set therefore varies by which columns happened to be NULL.
Server — desktop/macos/agent-cloud/agent.mjs:1592:
constcols=Object.keys(rows[0]);
That schema is then applied to all 100 rows of the batch via INSERT OR REPLACE.
Concrete failure: a screenshots batch whose first row was captured but not yet OCR'd/embedded omits ocrText and embedding, so cols excludes them. The other 99 rows — which do have OCR text and embeddings — are inserted without those columns. Because it is INSERT OR REPLACE (delete + insert), any values already on the VM are wiped as well. semantic_search (WHERE embedding IS NOT NULL) then silently returns nothing for those screenshots and screenshots_fts has no text to match. /sync returns {"applied": 100}, the desktop advances its cursor, and the rows are never resent.
The converse also holds: if row 0 has a column that later rows omit, those later rows get an explicit null written over real prior data.
Both sides verified by reading the current code; present on main and on the branch for #10256.
Found while working backwards from PostHog agent metrics. Not fixing it in the same change as the unrelated agent-proxy/backend fixes since it changes wire behaviour on the sync path and deserves its own review.
Activity
fix(desktop): sync each agent-VM row with its own column set
fix(desktop): sync each agent-VM row with its own column set (#10602) (…
Merge remote-tracking branch 'origin/main' into agent-subagent-improv…
Merge remote-tracking branch 'origin/main' into agent-subagent-improv…