Repository navigation
fix(platform): repair the agent document listing, read, and indexing - #3112
Merged
Merged
Conversation
Three 0.5-port defects stacked on the chat/sandbox document vertical: - The agent document listing selected folders.path, a column that does not exist (folders are a name+parent_id tree), so the chat "document" tool and sandbox document_find failed 100% since the cutover. Both shim doors now share one helper (documents/agent-list.ts) that derives the folder breadcrumb with a root-down recursive CTE (depth-capped) and restores the silently dropped fileName/extension filters the sandbox bridge passes. - documents/internal_queries:findDocumentByFileId was registered only on the sandbox shim map, which spreads the chat map one-way, so the chat rag_fetch inline fallback died as "[convex-shim] un-shimmed". The handler moves to the chat map (sandbox inherits) and now also selects content, which both doors' inline-document lane reads but the old handler never fetched. - The RAG ingest called indexDocument once and ignored `partial`: 0.4 committed one 64-chunk slice per scheduled invocation (the Convex action budget) and rescheduled until done, so the 0.5 port stamped rag_status=completed after slice one and left the corpus row 'processing' — a 936-chunk PDF read "Indexed" with 64 chunks stored, invisible to search and fetch (corpus readers filter on completed). The worker now drains every slice in-process (each slice committed and resumable, per-slice "Embedding… N/total" progress doubling as the watchdog's liveness signal, a zero-progress slice fails loud), and skipped:'unchanged' maps to completed instead of failed — a retry on an indexed document lands there. IndexDocumentResult gains a cumulative chunksStored, unit-asserted. Guards: the documents integration check gains an agent-listing leg (breadcrumb through both doors, fileName narrows, bogus extension empties, the read row reachable through the chat map) and the RAG loop gains a multi-slice leg (a ~158KB upload must reach completed with all chunks stored, > 64). The webdav check's rag === 'queued' assertion raced the worker's pickup and is widened to any live pipeline state. Integration 263/263.
This was referenced Sep 2, 2026
Israeltheminer
added a commit
that referenced
this pull request
Sep 3, 2026
Three legs the port left returning nothing, each under a comment saying no
0.5 table existed. All three tables existed.
kind="website" answered []. Migration 0045 created app.websites with every
column 0.4's reader projected, and listWebsites already existed.
kind="mail-attachment" answered {attachments: [], truncated: false}, while
migration 0037 shipped conversation_id and mail_received_at_ms and the email
binder writes both. truncated:false means "the walk reached the end of the
mail index", so the stub was also making a false claim. The new reader gates
every row on conversationAssignmentAllows against the conversation's current
assignment, resolving the caller's role and team ids rather than taking them
as arguments — a listing that skipped that would serve the whole inbox.
Migration 0064 adds the arrival index. The only existing index leads with
conversation_id, so it orders by conversation, which is the shape #3035
recorded as rejected: a by-arrival page reads most of its budget to return
one row, and above the budget reports "most recent" from an arbitrary window.
The task and project legs also lost their zero-hit listing fallback, leaving
listedSource unreachable. Restored in both.
Adds the reachability gate the chat map never had: every internal ref
reachable from the turn now needs a handler, using the walker the sandbox
bridge already had rather than a second copy. That absence is how #3112's
and #3128's missing handlers shipped.
Israeltheminer
added a commit
that referenced
this pull request
Sep 3, 2026
Three legs the port left returning nothing, each under a comment saying no
0.5 table existed. All three tables existed.
kind="website" answered []. Migration 0045 created app.websites with every
column 0.4's reader projected, and listWebsites already existed.
kind="mail-attachment" answered {attachments: [], truncated: false}, while
migration 0037 shipped conversation_id and mail_received_at_ms and the email
binder writes both. truncated:false means "the walk reached the end of the
mail index", so the stub was also making a false claim. The new reader gates
every row on conversationAssignmentAllows against the conversation's current
assignment, resolving the caller's role and team ids rather than taking them
as arguments — a listing that skipped that would serve the whole inbox.
Migration 0070 adds the arrival index. The only existing index leads with
conversation_id, so it orders by conversation, which is the shape #3035
recorded as rejected: a by-arrival page reads most of its budget to return
one row, and above the budget reports "most recent" from an arbitrary window.
The task and project legs also lost their zero-hit listing fallback, leaving
listedSource unreachable. Restored in both.
Adds the reachability gate the chat map never had: every internal ref
reachable from the turn now needs a handler, using the walker the sandbox
bridge already had rather than a second copy. That absence is how #3112's
and #3128's missing handlers shipped.
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.
A user asking the chat assistant to list their documents got
column f.path does not exist— and behind that first wall stood two more defects on the same vertical. All three are 0.5-port regressions; all three are fixed here, each with a guard that would have caught it.1. Listing: a phantom column killed both doors
Both shim ports of the agent document listing selected
coalesce(d.folder_path, f.path), butapp.foldershas nopathcolumn — folders are aname+parent_idtree — so Postgres rejected the whole statement and the chatdocumenttool and sandboxdocument_find(binding and user doors) failed 100% since the cutover. The port had also silently dropped thefileName/extensionfilters the sandbox bridge passes, and forked the two doors' near-identical SQL.The 0.4 semantics (folderPath = the row's own value, else the folder breadcrumb) now live in one Postgres-native helper,
domains/documents/agent-list.ts: a root-down recursive CTE (depth-capped; a cycle can never enter a root-down walk) joined ontofolder_id, with both filters restored — one helper behind two doors, which was the 0.4 contract.2. Read: un-shimmed on the chat door, content-less on both
documents/internal_queries:findDocumentByFileIdwas registered only in the sandbox shim map, which spreads the chat map one-way — so the chatrag_fetchinline fallback died as[convex-shim] un-shimmed. A sweep of everyinternal.*name the chat tools call against the chat map found exactly this one gap. The handler moves to the chat map (sandbox inherits) and now also selectscontent, which both doors' inline-document lane checks but the old handler never fetched — hub-authored inline documents were silently unreadable through the sandbox door too.3. Indexing: completed after one slice, corpus stuck processing
0.4 indexed in 64-chunk slices because a Convex action has a budget:
indexDocumentcommits one slice, answerspartial: true, and the caller reschedules until the last slice stamps the corpuscompleted. The 0.5indexUploadedFilecalled it once, ignoredpartial, and stamped the app rowcompleted— a 2.7 MB PDF read "Indexed" after ten seconds with 64 of 936 chunks stored and the corpus row stuckprocessing, where both corpus readers (keyword + dense filter onstatus = 'completed') and the corpus-text read could never see it. The watchdog cannot heal a wrongly-completed row (it only adopts queued/running/failed).The 0.5 worker owns the whole job, so it now drains the slices in-process: every slice stays committed and resumable (the plan resumes after the stored prefix), a zero-progress slice fails loud instead of spinning, and the per-slice
Embedding… N/totalprogress write doubles as the watchdog's liveness signal.IndexDocumentResultgains a cumulativechunksStored(unit-asserted), andskipped: 'unchanged'— the corpus already holds all of this exact content — maps tocompletedinstead offailed, which is where a retry on an indexed document lands.Why nothing caught any of it
The chat shim's only exercised document leg was knowledge-entries; neither listing door, the read row, nor a document wider than one slice had ever run against real Postgres.
Guards
Contracts/2026through both doors,fileNamenarrows to one, a bogus extension empties, and the read row is reachable through the chat map.completedwith corpus chunks stored == planned and > 64 — the mirror of the truncation this fixes.rag === 'queued'assertion raced the worker's pickup (the property was always "the PUT entered the pipeline") and is widened to any live pipeline state.convex/knowledge/indexing.test.tsassertschunksStoredacross the slice, resume, and unchanged paths.Verification
retry-rag(the resume path), after which the assistant listed the document with its folder path, searched it, and quoted § 90 BGB verbatim from page 43 with a source reference — the exact flow that produced the original error screenshot.MIGRATION.md carries this as inc 146; the README's stale integration-check count is refreshed.