Skip to content

v0.6.67: VFS upload fix, posthog/copilot correlation, exa date filters, logs panel width, tables UI/DB decoupling#4456

Merged
TheodoreSpeaks merged 5 commits intomainfrom
staging
May 5, 2026
Merged

v0.6.67: VFS upload fix, posthog/copilot correlation, exa date filters, logs panel width, tables UI/DB decoupling#4456
TheodoreSpeaks merged 5 commits intomainfrom
staging

Conversation

@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator

waleedlatif1 and others added 5 commits May 5, 2026 11:09
* refactor(tables): phase 1 — gutter numbering from array index

Delete the PositionGapRows component, the gap-fill loop, and the
GAP_CHECKBOX_CLASS / GAP_ROW_LIMIT / PositionGapRowsProps surface area.
The server's recompactPositions() guarantees positions are 0..N-1
contiguous in the unfiltered view, so the phantom-row machinery has
been defending against a state that essentially never happens.

DataRow now receives an arrayIndex prop and renders {arrayIndex + 1}
in the gutter. Selection coordinates still flow through row.position;
that switches in phase 2.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* refactor(tables): phase 2-5 — selection by array index, checks by row id

Decouple Tables UI selection coordinates from DB position:
- rowIndex semantics shift from row.position to array index across
  selection state, mouse handlers, keyboard nav, paste, scrollIntoView
- checkedRows: Set<number> (position) → Set<string> (rowId), survives
  sort/filter and realtime row inserts
- lastCheckboxRowRef stores rowId; shift-click range resolves to current
  array indices for visual-order ranges
- Drop positionMap/maxPosition derived state in favor of direct rowsRef
  reads
- ExpandedCellPopover anchors via data-row-id (row-id-stable) instead
  of data-row (array index)
- collectRowSnapshots accepts Iterable<TableRowType> directly
- Add bounds-validation effect to clamp anchor/focus when rows.length
  shrinks (sort change, pagination, realtime delete)
- Drop redundant arrayIndex prop on DataRow (rowIndex now equals it)

Server-side position math stays at API boundary only: insertRow,
duplicateRow, shift-Enter append, paste create-batch, undo snapshots.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* refactor(tables): rowId-stable selection across sort, position math via reduce

- Track anchor/focus by rowId so same-length sort changes remap selection
  to the new visual index instead of leaving it on a different row.
- Replace last-row position lookups with Math.max reduce in paste's
  create-batch and append-row's undo snapshot — under non-position sorts,
  the last visual row's position is not the largest.
- Trim a navigation-noise comment and tighten two over-explanatory ones.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(tables): guard rowId remap effect and document paste batch position

- Skip the validation effect when rows is empty (transient state during
  initial load of a new sort/filter before keepPreviousData populates) so
  selection survives uncached query changes.
- Skip when isColumnSelection is true; the column-selection pinning effect
  owns focus.rowIndex for those, and remapping would shrink a full-column
  range to wherever the captured endpoints happened to land after reorder.
- Comment lastRowPosition's hoist invariant so a future refactor doesn't
  move it inside the loop and produce colliding positions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
…60vw (#4449)

* improvement(logs): increase log details panel max width from 40vw to 60vw

* chore(logs): fix stale 65vw references in JSDoc comments
…#4453)

* feat(posthog): correlate task events with Go logs via request_id

Auto-injects server request_id into all PostHog server events from
AsyncLocalStorage context. Adds task_request_started client event fired
when SSE traceparent response header arrives, carrying the trace ID used
by Go for log correlation. task_generation_aborted now includes the
in-flight request_id when available.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* improvement(posthog): tighten trace ID parse and verbose comments

* fix(posthog): use traceparent header as canonical request_id source

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
#4454)

* fix(copilot): disambiguate VFS upload paths to prevent stale-row reads
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment May 5, 2026 9:58pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 5, 2026

PR Summary

Medium Risk
Includes a DB migration and changes to file-upload name resolution plus table selection/indexing logic, which could affect data lookup and UI interactions if edge cases are missed. Also adds new analytics fields and Exa search parameters with relatively contained impact.

Overview
Improves observability and fixes chat-upload VFS collisions. Adds workspace_files.display_name with a partial unique index per chat, updates chat-upload tracking to allocate collision-free display names (e.g. file (2).png), and switches VFS read/list/materialize flows to prefer displayName (with legacy fallback + normalized matching). Adds tests covering collision retries and legacy/normalized lookup.

Correlates task analytics with server request IDs. Extends useChat to surface the current trace/request id and fires a new task_request_started PostHog event; task_generation_aborted now optionally includes request_id, and server-side capture auto-injects request_id from request context when absent.

Extends tools/UI behavior. Adds Exa search date filters (start/endCrawlDate, start/endPublishedDate) across docs, block config, tool schema, and request body; increases log details panel max width ratio; and refactors tables to use row array indices/row IDs (not DB position) for selection/checkboxing and cell targeting, removing gap-row rendering and remapping selections across row reorder.

Reviewed by Cursor Bugbot for commit c09e0a0. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 5, 2026

Greptile Summary

This PR bundles five focused improvements: a VFS upload deduplication fix for copilot chat, PostHog/copilot correlation via request_id, date filters for the Exa search tool, a logs-panel width increase, and a tables UI/DB position decoupling.

  • VFS fix: Adds a display_name column and a partial unique index (chat_id, display_name) WHERE context = 'mothership' so concurrent uploads of files with the same name within a chat get collision-free suffixed paths, preventing stale-row reads by the LLM.
  • PostHog correlation: Fires task_request_started with the W3C traceparent trace ID as request_id on both the mothership and copilot views; the server-side captureServerEvent auto-stamps the same request_id from request context, enabling server-client log correlation.
  • Exa date filters: Adds startCrawlDate, endCrawlDate, startPublishedDate, endPublishedDate parameters (ISO 8601 strings) across the block config, tool config, type definitions, and docs.

Confidence Score: 4/5

Safe to merge — changes are well-isolated, the VFS deduplication path is covered by unit tests, and the DB migration is backward-compatible.

The VFS fix carefully handles race conditions by discriminating between two 23505 sources, and the migration adds only a nullable column with a partial index. The PostHog additions are fire-and-forget. The one gap — displayName not nulled out on file materialization — has no current functional impact.

apps/sim/lib/copilot/tools/handlers/materialize-file.ts warrants a second look for the displayName cleanup on workspace promotion.

Important Files Changed

Filename Overview
apps/sim/lib/uploads/contexts/workspace/workspace-file-manager.ts Core of the VFS fix: adds trackChatUpload with collision-free displayName allocation and correct 23505 discrimination between display-name vs. key-active index collisions.
apps/sim/lib/copilot/tools/handlers/materialize-file.ts Correctly adopts displayName as the canonical workspace originalName on materialization; does not reset displayName to NULL when promoting to workspace context.
apps/sim/lib/copilot/tools/handlers/upload-file-reader.ts Correctly resolves VFS names via displayName for new rows and originalName for legacy NULL rows; normalized segment fallback handles macOS U+202F filenames.
packages/db/migrations/0202_fuzzy_darkstar.sql Adds nullable display_name column and partial unique index on (chat_id, display_name) scoped to mothership context; backward-compatible with legacy NULL rows.
apps/sim/lib/posthog/server.ts Auto-stamps request_id from request context on server-side events when not already set, enabling server-client log correlation.
apps/sim/tools/exa/search.ts Adds four date-filter parameters forwarded as-is to Exa API; consistent with existing string-pass-through pattern.
apps/sim/stores/logs/utils.ts Increases log details panel max width ratio from 0.4 to 0.6; viewport-safe clamping logic unchanged.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/utils.ts Introduces expandToDisplayColumns and buildHeaderGroups utilities to decouple UI display indices from DB row positions.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Client uploads file to Chat] --> B[trackChatUpload called]
    B --> C{Try UPDATE: set displayName candidate}
    C -->|Row found| D[Return displayName to caller]
    C -->|No row| E{Try INSERT with displayName candidate}
    E -->|Success| D
    E -->|23505 on displayName index| F[Increment suffix n++]
    F --> C
    E -->|23505 on key-active index| G[Throw - concurrent race, do not retry]
    D --> H[LLM sees uploads/filename-n.ext in VFS]
Loading

Reviews (1): Last reviewed commit: "fix(copilot): disambiguate VFS upload pa..." | Re-trigger Greptile

Comment thread apps/sim/lib/copilot/tools/handlers/materialize-file.ts
Comment thread apps/sim/lib/uploads/contexts/workspace/workspace-file-manager.ts
@TheodoreSpeaks TheodoreSpeaks merged commit 8d6b615 into main May 5, 2026
31 checks passed
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.

2 participants