Skip to content

fix(mothership): stop Chat reading files search as a download of a file named search - #8930

Closed
waleedlatif1 wants to merge 1 commit into
stagingfrom
fix/chat-files-search-routing
Closed

waleedlatif1 wants to merge 1 commit into
stagingfrom
fix/chat-files-search-routing

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • The Chat CLI file transport matched GET /api/v2/files/search with its ^([^/]+)$ file-id pattern. It treated files search as a direct download of a file with id search, so the command failed with an unrelated validation error (Unrecognized key: "query").
  • The transport now recognizes the search route and doesn't misroute it.
  • For now it refuses the route with a clear message that points to grep <pattern> --scope files. Search results quote indexed file text but don't report the provenance of the files they quote, so passing them through would let content of unknown provenance reach the model unchecked. A separate change makes the search use case report per-file provenance. Once that lands, this branch can forward search through the provenance-admitting path like bulk download.
  • The change is confined to the transport's path matching.

Type of Change

  • Bug fix

Testing

  • New case in file-provenance.test.ts runs files search --query … through the real CLI handler. It expects the clear refusal and that no file lookup or storage read happens. It fails on the old code with the download-contract validation error.
  • bunx vitest run lib/mothership/agent-cli passes (300 tests). bun run test:scripts passes.
  • bun run lint, bun run type-check and bun run check:audits pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…le named search

The Chat file transport matched GET /api/v2/files/search as a direct download of file id 'search', so files search failed with an unrelated validation error. It now recognizes the search route and refuses it with a message pointing at grep --scope files, because search results quote file text without reporting file provenance and so cannot be admitted to Chat yet.

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; it fixes the search-path mix-up without changing other file reads.

Summary

Chat now recognizes files search before treating the path as a file download.

  • Chat recognizes file search and points users to grep instead.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Chat: files search --query …"] --> B["GET /api/v2/files/search"]
  B --> C["Match searchPath before file-ID matching"]
  C --> D["403 with grep alternative"]
  D --> E["No file lookup or storage read"]
Loading

Reviews (1) · Last reviewed commit: "fix(mothership): stop Chat reading files..." · Reviewed by Greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

Closing: this fix is being consolidated with the other file-provenance fixes into a single PR with one shared abstraction. The branch is kept for reference.

@waleedlatif1
waleedlatif1 deleted the fix/chat-files-search-routing branch October 12, 2026 18:13
@vercel

vercel Bot commented Oct 12, 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 12, 2026 6:50pm UTC

Request Review

This branch was previously deployed

1 inactive deployment
Preview — 10526299 Deployed Oct 12, 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