Repository navigation
fix(search): return actionable live read errors and drop unreadable Confluence matches - #8888
waleedlatif1 wants to merge 3 commits into
Conversation
…onfluence matches read_document collapsed every provider-side read failure into the generic 'Knowledge operation failed' because NativeSearchError escaped readLiveDocument unclassified. Reads now map a 404/410 to not_found with a search-again hint, a revoked grant to unauthorized naming the provider, and rate limits, 5xx, provider timeouts, MCP request timeouts and the read deadline to a retryable LiveReadError that the Assistant tool reports with retryable (and retryAfterSeconds) like search_workspace. Confluence search labeled every non-blogpost CQL hit a page, so native CQL matching attachments, comments, whiteboards, folders or databases produced references whose v2 page read 404s. Those kinds are now dropped and the page message says so.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
2 issues found across 7 files
Confidence score: 3/5
- In
application.ts, native requests can time out before the read deadline and arrive as raw transport errors, so they may miss the retry path. Classify recognized transport timeouts as retryable. - In
atlassian.ts, excluded CQL rows can leavepartialfalse for a single site, so callers reportokdespite incomplete results. Includeexcludedwhen computingpartial.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/lib/sim-search/live/application.ts">
<violation number="1" location="apps/sim/lib/sim-search/live/application.ts:795">
P2: Native provider request timeouts can arrive here as raw transport errors: `createNativeClient` uses a 10-second request timeout, before the 15-second read deadline. Classify recognized transport timeout errors as retryable `LiveReadError`s instead of letting them escape as generic failures.</violation>
</file>
<file name="apps/sim/lib/sim-search/live/atlassian.ts">
<violation number="1" location="apps/sim/lib/sim-search/live/atlassian.ts:212">
P2: This drops matching CQL rows but leaves `partial` false for a single site, so callers report status `ok` despite known omitted matches. Include `excluded` in `partial` so callers treat coverage as incomplete.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
| `${name} took too long to return this document. Try again, or read a different result.`, | ||
| true | ||
| ) | ||
| return error |
There was a problem hiding this comment.
P2: Native provider request timeouts can arrive here as raw transport errors: createNativeClient uses a 10-second request timeout, before the 15-second read deadline. Classify recognized transport timeout errors as retryable LiveReadErrors instead of letting them escape as generic failures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/sim/lib/sim-search/live/application.ts, line 795:
<comment>Native provider request timeouts can arrive here as raw transport errors: `createNativeClient` uses a 10-second request timeout, before the 15-second read deadline. Classify recognized transport timeout errors as retryable `LiveReadError`s instead of letting them escape as generic failures.</comment>
<file context>
@@ -742,6 +748,53 @@ export type LiveReadInput = ResourceOwner & {
+ `${name} took too long to return this document. Try again, or read a different result.`,
+ true
+ )
+ return error
+}
+
</file context>
| }) | ||
| ) | ||
| const documents = interleaveByRank(pages.map((result) => result.documents)) | ||
| const excluded = pages.some((result) => result.excluded) |
There was a problem hiding this comment.
P2: This drops matching CQL rows but leaves partial false for a single site, so callers report status ok despite known omitted matches. Include excluded in partial so callers treat coverage as incomplete.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/sim/lib/sim-search/live/atlassian.ts, line 212:
<comment>This drops matching CQL rows but leaves `partial` false for a single site, so callers report status `ok` despite known omitted matches. Include `excluded` in `partial` so callers treat coverage as incomplete.</comment>
<file context>
@@ -183,22 +195,31 @@ export async function searchAtlassian(
})
)
const documents = interleaveByRank(pages.map((result) => result.documents))
+ const excluded = pages.some((result) => result.excluded)
return {
documents,
</file context>
|
| if (deadline?.aborted || (error instanceof McpError && error.code === ErrorCode.RequestTimeout)) | ||
| return new LiveReadError( | ||
| `${name} took too long to return this document. Try again, or read a different result.`, | ||
| true | ||
| ) | ||
| return error |
There was a problem hiding this comment.
Native timeouts still look permanent
createNativeClient sets a 10-second request timeout, which can throw a plain Error with code: 'ETIMEDOUT'. The 15-second read deadline has not fired yet, so liveReadFailure returns this error unchanged. The Assistant then reports retryable: false, and MCP returns generic failure text instead of retry guidance.
Recognize the transport's timeout errors, including the dispatcher timeout path, and return a retryable LiveReadError.
Summary
read_documentturned every provider-side read failure into the generic "Knowledge operation failed", becauseNativeSearchErrorescapedreadLiveDocumentwithout being classified. Reads now return errors the model can act on:not_found, with a hint to search again or read a different result;unauthorized, naming the provider to reconnect;LiveReadError.read_documenttool now reportsretryable(andretryAfterSecondswhen set), the same waysearch_workspacedoes. The Search MCPread_documentreturns the classified message instead of the generic text.page. Native CQL that matched attachments, comments, whiteboards, folders or databases therefore produced references whose v2 page read returns 404. Those kinds are now dropped, and the result message says so.Test plan
application.test.ts: covers 404, reconnect, rate limit, 503 and MCP timeout. All five fail with the fix reverted.atlassian.test.ts: covers native CQL matches that a page read can't open. It fails with the fix reverted.🤖 Generated with Claude Code