Skip to content

fix(agent-service): keep disabled tools away from the model - #9149

Merged
xuang7 merged 2 commits into
apache:mainfrom
shaynhornik:fix/agent-disabled-tools
Nov 16, 2026
Merged

xuang7 merged 2 commits into
apache:mainfrom
shaynhornik:fix/agent-disabled-tools

Conversation

@shaynhornik

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Tools in settings.disabledTools were shown as enabled: false by system-info, but sendMessage still passed every tool to generateText, so the agent could call a disabled tool and it ran.

sendMessage now passes only the enabled tools, through a small getEnabledTools() helper. this.tools is unchanged, so getSystemInfo() still lists every tool with its enabled flag.

Any related issues, documentation, discussions?

Closes #9122

How was this PR tested?

Two new tests in texera-agent.spec.ts, both using the ai/test mock model:

  • With modifyOperator disabled, the model call gets only deleteOperator and addOperator, and system info still lists modifyOperator as disabled.
  • With deleteOperator disabled, a model that calls it anyway does not delete the operator.

Both fail without the change. Locally: bun test (312 pass), tsc --noEmit and prettier --check are clean.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5.5). I reviewed and tested the change.

🤖 Generated with Claude Code

Tools listed in settings.disabledTools were reported as disabled by
system-info but were still passed to generateText, so the agent could
call and run them. sendMessage now passes only the enabled tools; system
info still lists every tool with its enabled flag.

Closes apache#9122

Generated-by: Claude Code (Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Yicong-Huang Yicong-Huang added release/v1.3 back porting to release/v1.3 release/v1.2 back porting to release/v1.2 labels Oct 26, 2026
@github-actions
github-actions Bot requested review from mengw15 and xuang7 October 26, 2026 13:09
@github-actions

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. A release/* label nominates a backport target; the branch's release manager approving this PR is what sends the fix there. The required Backport Approvals check stays red until every label below is approved, so each manager either approves or removes their own label — which is why the labels left on a merged PR are exactly the branches it reached.

Release branch Analysis
✅ release/v1.3 Change detected on this branch — label added; this fix is queued to backport here. @mengw15 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other. Review requested.
✅ release/v1.2 Change detected on this branch — label added; this fix is queued to backport here. @xuang7 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other. Review requested.

Auto-label run.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @bobbai00
    You can notify them by mentioning @bobbai00 in a comment.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for your first contribution to Texera, @shaynhornik!

If you're looking for a good place to start, browse issues labeled starter-task; they're scoped to be approachable for newcomers.

You can drive common housekeeping yourself by commenting one of these commands on its own line:

  • Issues. Comment /take to assign an open issue to yourself, or /untake to release it. You can find unclaimed work with the search filter is:issue is:open no:assignee.
  • Sub-issues. To link issues into a parent/child hierarchy, comment /sub-issue #5166 #5222 on the parent to attach those children (or /unsub-issue #5166 #5222 to detach them). From a child issue, comment /parent-issue #5166 to set its parent, or /unparent-issue to clear it (the current parent is detected automatically). References may be written as #5166 or as a bare 5166; cross-repository references are not supported.
  • Pull requests (author only). Comment /request-review @user to request a review from someone, or /unrequest-review @user to withdraw that request.

Each command must match exactly: /take this will not work, only /take does. For the full contribution flow, see CONTRIBUTING.md.

@mengw15 mengw15 removed the release/v1.3 back porting to release/v1.3 label Nov 9, 2026
@yrenat

yrenat commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Looks good to me!

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

LGTM

@bobbai00

Copy link
Copy Markdown
Contributor

@xuang7 do we still want to backport to v1.2 ?

@codecov-commenter

codecov-commenter commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.60%. Comparing base (52093b4) to head (33f2109).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9149      +/-   ##
============================================
- Coverage     91.60%   91.60%   -0.01%     
  Complexity     5037     5037              
============================================
  Files          1283     1283              
  Lines         57004    56997       -7     
  Branches       7419     7417       -2     
============================================
- Hits          52221    52214       -7     
  Misses         2914     2914              
  Partials       1869     1869              
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from 81613a4
agent-service 99.56% <100.00%> (+<0.01%) ⬆️
amber 85.33% <ø> (ø) Carriedforward from 81613a4
computing-unit-managing-service 64.05% <ø> (ø) Carriedforward from 81613a4
config-service 87.73% <ø> (ø) Carriedforward from 81613a4
file-service 82.31% <ø> (ø) Carriedforward from 81613a4
frontend 96.41% <ø> (-0.01%) ⬇️ Carriedforward from 81613a4
notebook-migration-service 83.77% <ø> (ø) Carriedforward from 81613a4
pyamber 98.50% <ø> (ø) Carriedforward from 81613a4
workflow-compiling-service 78.30% <ø> (ø) Carriedforward from 81613a4

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xuang7

xuang7 commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Removing release/v1.2. The fix applies there, but nothing on that branch sets disabledTools: the frontend has no control for it and only ever sends an empty list, so the setting is reachable only through the settings REST API. Keeping it on main.

@xuang7 xuang7 removed the release/v1.2 back porting to release/v1.2 label Nov 16, 2026
@xuang7
xuang7 enabled auto-merge November 16, 2026 04:31
@xuang7
xuang7 added this pull request to the merge queue Nov 16, 2026
Merged via the queue into apache:main with commit b516b2c Nov 16, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disabled tools can still be called by the agent

7 participants