Skip to content

fix(mobile): bound AI content search tool hangs#433

Open
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-mobile-ai-tool-search-hang
Open

fix(mobile): bound AI content search tool hangs#433
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-mobile-ai-tool-search-hang

Conversation

@codedogQBY

Copy link
Copy Markdown
Owner

Analysis

  • [Bug] 安卓端ai对话时一旦开始搜索内容就会卡住 #410 reports Android chat becoming unusable after the AI starts a content search tool: the UI remains in tool-calling state and the model never receives the next tool result.
  • The mobile fallback content path can leave a Promise pending forever if the hidden extractor WebView never replies. It also reads the whole original book into JS memory before extraction, which is risky on Android for larger books.
  • The agent also had no per-tool timeout, so any stalled tool could keep the streaming turn open indefinitely.

Changes

  • Add a core fallback content provider timeout so original-file fallback extraction cannot leave a tool call pending forever.
  • Add a per-tool timeout in the reading agent and return a structured { error } result when a tool runs too long.
  • Add timeout/unmount cleanup for Expo ExtractorWebView extraction requests.
  • Guard mobile original-file fallback search against remote/missing files and files larger than 12 MB before reading bytes into JS memory.
  • Add focused tests for stalled fallback providers and stalled agent tools.

Verification

  • pnpm exec biome check packages/core/src/ai/fallback-content-service.ts packages/core/src/ai/__tests__/fallback-content-service.test.ts packages/core/src/ai/agents/reading-agent.ts packages/core/src/ai/__tests__/reading-agent-tools.test.ts packages/app-expo/src/components/rag/ExtractorWebView.tsx packages/app-expo/src/screens/LibraryScreen.tsx
    • Passes with existing noExplicitAny warnings in packages/core/src/ai/agents/reading-agent.ts.
  • pnpm --filter @readany/core test -- fallback-content-service reading-agent-tools
  • pnpm --filter @readany/core exec tsc --noEmit
  • pnpm --filter @readany/app-expo exec tsc --noEmit
  • git diff --check

Fixes #410

@codedogQBY codedogQBY added bug Something isn't working priority:p1 High: important feature broken or major platform/workflow regression area:ai AI, model configuration, vectorization, citations, prompts area:mobile Mobile, tablet, React Native, Android, iOS labels Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai AI, model configuration, vectorization, citations, prompts area:mobile Mobile, tablet, React Native, Android, iOS bug Something isn't working priority:p1 High: important feature broken or major platform/workflow regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 安卓端ai对话时一旦开始搜索内容就会卡住

1 participant