Skip to content

Classify browser_attach_* tools in ToolAccessProfiles - #4

Merged
jddunn merged 3 commits into
masterfrom
feat/attach-tool-policy
Jul 21, 2026
Merged

Classify browser_attach_* tools in ToolAccessProfiles#4
jddunn merged 3 commits into
masterfrom
feat/attach-tool-policy

Conversation

@jddunn

@jddunn jddunn commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Adds the five browser_attach_* tool ids to TOOL_CATEGORY_MAP under search, so the assistant profile permits attach-mode browsing while system-only profiles don't. Override-blocking still works per agent. Pairs with framerslab/agentos-extensions#35 (the tools themselves).

Summary by Sourcery

Classify browser attach-mode tools under the search category and verify assistant-profile access and override behavior.

Enhancements:

  • Map all browser_attach_* tool identifiers to the search tool category so attach-mode browsing aligns with existing browser tool policies.

Tests:

  • Add tests to ensure all browser_attach_* tools are categorized as search and that assistant profile permissions and per-agent overrides behave as expected.

The assistant profile now permits the attach tool family (same 'search'
category as the launch-mode browser tools); system-only profiles still
exclude them, and a per-agent override can lock them off inside any profile.
@sourcery-ai

sourcery-ai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Reviewer's Guide

Classifies new browser_attach_* tools under the existing 'search' category and verifies that the assistant tool access profile permits them while still respecting per-agent override blocking.

Sequence diagram for browser_attach_* tool authorization via ToolAccessProfiles

sequenceDiagram
  actor User
  participant Agent
  participant ToolAccessProfiles
  participant BrowserAttachTool

  User->>Agent: request browser_attach_read
  Agent->>ToolAccessProfiles: getToolCategory(browser_attach_read)
  ToolAccessProfiles-->>Agent: search
  Agent->>Agent: isToolAllowedForProfile(search, assistant)
  Agent-->>User: tool permitted
  Agent->>BrowserAttachTool: execute browser_attach_read
  BrowserAttachTool-->>Agent: result
  Agent-->>User: return research result
Loading

File-Level Changes

Change Details Files
Map new browser_attach_* tool IDs into the search tool category so profile-based access control treats them like other search/browser tools.
  • Extend TOOL_CATEGORY_MAP to include browser_attach_status, browser_attach_claim, browser_attach_goto, browser_attach_read, and browser_attach_release mapped to 'search'.
  • Document in comments that attach-mode tools are read-only research tools that share the 'search' category with launch-mode browser tools, affecting which profiles can use them.
src/autonomy/social/ToolAccessProfiles.ts
Add tests to ensure browser_attach_* tools are categorized as search and that assistant profile permissions and overrides behave as expected.
  • Add a test that iterates over all browser_attach_* IDs and asserts they are classified under the 'search' category in TOOL_CATEGORY_MAP.
  • Add a test that the 'assistant' tool access profile allows browser_attach_goto and browser_attach_read by default.
  • Add a test assertion showing that per-agent overrides (additionalBlocked) can still block specific browser_attach_* tools even when the category is allowed by the profile.
src/autonomy/social/__tests__/ToolAccessProfiles.test.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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

Hey - I've found 1 issue, and left some high level feedback:

  • Consider extracting the list of browser_attach_* tool IDs into a shared constant used both in TOOL_CATEGORY_MAP and the tests to avoid duplication and the risk of the lists diverging.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting the list of `browser_attach_*` tool IDs into a shared constant used both in `TOOL_CATEGORY_MAP` and the tests to avoid duplication and the risk of the lists diverging.

## Individual Comments

### Comment 1
<location path="src/autonomy/social/__tests__/ToolAccessProfiles.test.ts" line_range="387-396" />
<code_context>
+    }
+  });
+
+  it('assistant profile permits attach tools, and an override can still block them', () => {
+    const assistant = getToolAccessProfile('assistant');
+    expect(isToolAllowedByProfile(assistant, 'browser_attach_goto')).toBe(true);
+    expect(isToolAllowedByProfile(assistant, 'browser_attach_read')).toBe(true);
+    // A per-agent override wins over the category allow — attach can be locked
+    // off even inside the assistant profile.
+    expect(
+      isToolAllowedByProfile(assistant, 'browser_attach_goto', { additionalBlocked: ['browser_attach_goto'] }),
+    ).toBe(false);
+  });
 });
</code_context>
<issue_to_address>
**suggestion (testing):** Add a complementary assertion for a non-assistant profile to prove attach tools are blocked as intended.

This test confirms that the `assistant` profile allows attach tools and that per-agent overrides can still block them. To fully cover the behavior in the PR, please also add an assertion for a non-search-allowed profile (e.g. `getToolAccessProfile('system')`) verifying that `isToolAllowedByProfile(systemProfile, 'browser_attach_goto')` is `false`. That will prove that classifying these tools under `search` correctly prevents their use in system-only or other restricted profiles.

```suggestion
  it('assistant profile permits attach tools, and an override can still block them', () => {
    const assistant = getToolAccessProfile('assistant');
    expect(isToolAllowedByProfile(assistant, 'browser_attach_goto')).toBe(true);
    expect(isToolAllowedByProfile(assistant, 'browser_attach_read')).toBe(true);
    // A per-agent override wins over the category allow — attach can be locked
    // off even inside the assistant profile.
    expect(
      isToolAllowedByProfile(assistant, 'browser_attach_goto', { additionalBlocked: ['browser_attach_goto'] }),
    ).toBe(false);

    // Non-search-allowed profiles (e.g. system) must not be able to use attach tools.
    const systemProfile = getToolAccessProfile('system');
    expect(isToolAllowedByProfile(systemProfile, 'browser_attach_goto')).toBe(false);
  });
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +387 to +396
it('assistant profile permits attach tools, and an override can still block them', () => {
const assistant = getToolAccessProfile('assistant');
expect(isToolAllowedByProfile(assistant, 'browser_attach_goto')).toBe(true);
expect(isToolAllowedByProfile(assistant, 'browser_attach_read')).toBe(true);
// A per-agent override wins over the category allow — attach can be locked
// off even inside the assistant profile.
expect(
isToolAllowedByProfile(assistant, 'browser_attach_goto', { additionalBlocked: ['browser_attach_goto'] }),
).toBe(false);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (testing): Add a complementary assertion for a non-assistant profile to prove attach tools are blocked as intended.

This test confirms that the assistant profile allows attach tools and that per-agent overrides can still block them. To fully cover the behavior in the PR, please also add an assertion for a non-search-allowed profile (e.g. getToolAccessProfile('system')) verifying that isToolAllowedByProfile(systemProfile, 'browser_attach_goto') is false. That will prove that classifying these tools under search correctly prevents their use in system-only or other restricted profiles.

Suggested change
it('assistant profile permits attach tools, and an override can still block them', () => {
const assistant = getToolAccessProfile('assistant');
expect(isToolAllowedByProfile(assistant, 'browser_attach_goto')).toBe(true);
expect(isToolAllowedByProfile(assistant, 'browser_attach_read')).toBe(true);
// A per-agent override wins over the category allow — attach can be locked
// off even inside the assistant profile.
expect(
isToolAllowedByProfile(assistant, 'browser_attach_goto', { additionalBlocked: ['browser_attach_goto'] }),
).toBe(false);
});
it('assistant profile permits attach tools, and an override can still block them', () => {
const assistant = getToolAccessProfile('assistant');
expect(isToolAllowedByProfile(assistant, 'browser_attach_goto')).toBe(true);
expect(isToolAllowedByProfile(assistant, 'browser_attach_read')).toBe(true);
// A per-agent override wins over the category allow — attach can be locked
// off even inside the assistant profile.
expect(
isToolAllowedByProfile(assistant, 'browser_attach_goto', { additionalBlocked: ['browser_attach_goto'] }),
).toBe(false);
// Non-search-allowed profiles (e.g. system) must not be able to use attach tools.
const systemProfile = getToolAccessProfile('system');
expect(isToolAllowedByProfile(systemProfile, 'browser_attach_goto')).toBe(false);
});

jddunn added 2 commits July 20, 2026 19:49
Mission emits CSV but not HTML/PDF; assistant research missions want a
shareable report. Deterministic CSV (RFC-4180 escaping) + self-contained
print-safe HTML + PDF via an ISOLATED headless Chrome --user-data-dir
(never the live profile). PDF is best-effort; CSV + HTML always land.
…verify

Guide covers the contract, prerequisites, transports, running, export, and
troubleshooting. Example mission demonstrates the read-only attach flow.
The E2E verify (WUNDERLAND_ATTACH_E2E-gated) asserts other tabs stay
byte-identical across a session — the marker-tab contract.
@jddunn
jddunn merged commit dbb6512 into master Jul 21, 2026
1 of 2 checks passed
@jddunn
jddunn deleted the feat/attach-tool-policy branch July 21, 2026 02:54
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