Skip to content

fix(search): return actionable live read errors and drop unreadable Confluence matches - #8888

Open
waleedlatif1 wants to merge 2 commits into
stagingfrom
fix/live-read-errors
Open

waleedlatif1 wants to merge 2 commits into
stagingfrom
fix/live-read-errors

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • read_document turned every provider-side read failure into the generic "Knowledge operation failed", because NativeSearchError escaped readLiveDocument without being classified. Reads now return errors the model can act on:
    • a 404 or 410 becomes not_found, with a hint to search again or read a different result;
    • a revoked grant becomes unauthorized, naming the provider to reconnect;
    • rate limits, 5xx responses, provider timeouts, MCP request timeouts and the 15 s read deadline become a retryable LiveReadError.
  • The Assistant read_document tool now reports retryable (and retryAfterSeconds when set), the same way search_workspace does. The Search MCP read_document returns the classified message instead of the generic text.
  • Confluence search labeled every non-blogpost CQL hit a 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.
  • Focused suites pass locally: application, atlassian, policy, workspace-search, mcp server.
  • CI

🤖 Generated with Claude Code

…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.
@vercel

vercel Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 10, 2026 7:11am UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 leave partial false for a single site, so callers report ok despite incomplete results. Include excluded when computing partial.
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

@cubic-dev-ai cubic-dev-ai Bot Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Fix with cubic

})
)
const documents = interleaveByRank(pages.map((result) => result.documents))
const excluded = pages.some((result) => result.excluded)

@cubic-dev-ai cubic-dev-ai Bot Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Fix with cubic

@greptile-apps

greptile-apps Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Changes how search handles read failures and filters Confluence results.

Fix native transport timeout classification before merging so temporary read failures receive the promised retry guidance.

Findings

  1. P1 Native timeouts still look permanent ▶

Summary

This PR gives live document reads clearer errors and removes Confluence matches that the reader cannot open.

  • Live document reads tell callers what happened and when to retry.
  • Confluence search leaves out matches its read path cannot open.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Live document read] --> B[Resolve account and check access]
  B --> C[Read from provider]
  C --> D{Read outcome}
  D -->|Success| E[Check current access and return content]
  D -->|Known provider error| F[Classify missing, reconnect, or retry]
  D -->|Read deadline or MCP timeout| G[Retryable LiveReadError]
  D -->|Native transport timeout at 10 seconds| H[Unchanged error]
  F --> I[Assistant or MCP response]
  G --> I
  H --> J[Generic error; Assistant says not retryable]
Loading

Reviews (1) · Last reviewed commit: "fix(search): return actionable live read..." · Reviewed by Greptile

Comment on lines +790 to +795
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

This branch was previously deployed

1 inactive deployment
Preview — 23596abf Deployed Oct 10, 2026 by vercel[bot]
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.

1 participant