Skip to content

🕯️ feat: Search Text in Attached Workspaces - #15525

Merged
danny-avila merged 9 commits into
devfrom
danny-avila/code-workspace-search
Sep 4, 2026
Merged

danny-avila merged 9 commits into
devfrom
danny-avila/code-workspace-search

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

I added a first-class, read-only search_workspace tool for attached BYOM environments. This PR is stacked on #15524 and uses the search_text operation provided by LibreChat-AI/code-interpreter#90.

  • Register search_workspace only when the selected code environment is attached.
  • Search literal text in an optional relative workspace path without requiring Git.
  • Forward the principal-bound worker route through the existing authenticated Code API client.
  • Cap searches at 200 matches and retain the tool name for safe conversation-history replay.
  • Validate worker result shapes and reject unexpected host metadata before model exposure.
  • Apply LibreChat file-content and filename filters to every match before returning any results.
  • Suppress upstream worker error details from model-visible failures.

Change Type

  • New feature (non-breaking change which adds functionality)

Testing

  • Ran 212 focused Jest tests for agent handlers, tool registration/history, and the workspace HTTP client.
  • Ran the repository import-sort checker across all nine changed files.
  • Ran TypeScript checks and confirmed no errors in changed files; the shared local @librechat/agents install still reports unrelated RuntimeProviderName errors in memory tests.
  • Ran a live isolated E2E with Code API on port 23116, Redis on port 26384, and an outbound worker rooted at a non-Git directory. Verified the real LibreChat event handler returned notes.txt:2:23 for a literal search.

Test Configuration:

  • macOS arm64
  • Node.js 24.16.0
  • Code API: http://127.0.0.1:23116/v1
  • Redis: 127.0.0.1:26384
  • Workspace: isolated plain directory with no .git metadata

Checklist

  • My code adheres to this project’s style guidelines
  • I have performed a self-review of my own code
  • I have commented in complex areas of my code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective
  • Local focused unit tests pass with my changes
  • I listed the stacked and downstream dependencies explicitly

@danny-avila
danny-avila force-pushed the danny-avila/code-workspace-search branch from 915f543 to dccd77e Compare September 2, 2026 18:10
Copilot AI lite review requested due to automatic review settings September 2, 2026 18:24
@danny-avila
danny-avila force-pushed the danny-avila/code-workspace-search branch from dccd77e to 3e362aa Compare September 2, 2026 18:24

Copilot AI 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.

🟡 Changes recommended

The new search_workspace handler can emit an unboundedly large tool response string, risking downstream tool-output/message limits without local truncation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new read-only search_workspace tool for attached BYOM code environments, routing literal text searches through the authenticated Code API workspace-tools endpoint and validating/guarding worker responses before exposing results to the model.

Changes:

  • Register search_workspace alongside attached-workspace read_file, including historical tool-name retention and code-session awareness.
  • Add handler plumbing to execute workspace searches via the existing Code API client, with input validation, result-shape validation, and file/filename filtering per match.
  • Add focused Jest coverage across the workspace HTTP client, tool registration, handler execution, and server-side Code process wiring.
File summaries
File Description
packages/api/src/code/workspace.spec.ts Adds a regression test ensuring bounded/validated search match shapes are rejected before exposure.
packages/api/src/agents/tools.ts Defines search_workspace tool schema and registers it only when attached-workspace tools are enabled.
packages/api/src/agents/tools.spec.ts Extends tool-registration tests to cover search_workspace and historical tool-name inclusion.
packages/api/src/agents/handlers.ts Implements search_workspace tool-call handling, environment gating, filtering, and error suppression.
packages/api/src/agents/handlers.spec.ts Adds handler tests for attached search routing, gating, and per-match filtering behavior.
api/server/services/Files/Code/process.spec.js Adds coverage for forwarding authenticated search requests through the Code process layer.
api/server/services/Files/Code/process.js Implements searchWorkspace forwarding to executeWorkspaceTool with proper headers and request mapping.
api/server/services/Endpoints/agents/skillDeps.spec.js Verifies searchWorkspace is exposed on agent handler deps.
api/server/services/Endpoints/agents/skillDeps.js Wires searchWorkspace into stable skill tool dependencies for agent handlers.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/api/src/agents/handlers.ts Outdated
@danny-avila
danny-avila force-pushed the danny-avila/code-workspace-search branch from 3e362aa to 8cada1f Compare September 2, 2026 19:16
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review\n\nPlease review the current PR head 8cada1f. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-04T03:57:03.417370Z 74ec00c Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 8cada1f5fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila danny-avila changed the title 🔭 feat: Search Attached Workspaces 🕵️ feat: Search Files In Attached Workspaces Sep 2, 2026
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review\n\nPlease review the current PR head 3b63af9. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b63af9b13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/agents/handlers.ts
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review\n\nPlease review the current PR head 9d1864a. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 9d1864a1fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review\n\nPlease review the current PR head 9d1864a. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 9d1864a1fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila danny-avila changed the title 🕵️ feat: Search Files In Attached Workspaces 🕯️ feat: Search Text in Attached Workspaces Sep 3, 2026
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review commit 69ebb06

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review commit 39dcd17 (current restacked head)

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 39dcd17b9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current PR head 74ec00c. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 74ec00c68f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Base automatically changed from danny-avila/code-workspace-tool-adapter to dev September 4, 2026 13:58
@danny-avila
danny-avila force-pushed the danny-avila/code-workspace-search branch from 5690f9f to 3aa40db Compare September 4, 2026 13:58
@danny-avila
danny-avila merged commit 9a64e85 into dev Sep 4, 2026
30 checks passed
@danny-avila
danny-avila deleted the danny-avila/code-workspace-search branch September 4, 2026 14:07
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.

2 participants