Skip to content

feat(site/src/pages/AgentsPage/components/ChatMessageInput): insert agent delegations with @ in the composer - #183

Merged
ibetitsmike merged 8 commits into
mainfrom
mike/agent-usage-4-mention
Nov 11, 2026
Merged

ibetitsmike merged 8 commits into
mainfrom
mike/agent-usage-4-mention

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of @ibetitsmike.

Part of #187 (U2, delegate with @).

Chats can delegate to a custom agent through spawn_agent, but you had to know the exact type name, which is qualified (personal/<name>, org/<name>, ...) when more than one source defines it. Behind the fork-agent-definitions experiment, typing @ in the composer now opens a menu of the agent types the chat can spawn:

  • Trigger: @ at the start of a line or after whitespace, so email addresses stay plain text.
  • List: the built-in general and explore types first, then the enabled personal, organization and project definitions, plus the workspace subagent files from the chat's context. It applies chatd's naming rules: reserved names are skipped, the first of a name within a source wins, and a name that more than one source defines (or any name while a list is still loading) is offered by its qualified name.
  • Where: in a child chat the menu shows only in a general child with fork-nested-subagents on, where chatd gives it spawn_agent. Custom children are left out because their definition can remove spawn_agent and the client can't see it. A child lists its root chat's project definitions, fetched when the menu opens. The client can't see the depth limit either, so a general child at the maximum depth still shows the menu.
  • Keyboard and screen readers: Lexical's typeahead drives the keys, and the options render inside its typeahead-menu listbox with its typeahead-item-N ids, so the editor's aria-controls and aria-activedescendant point at the real options. Enter does nothing while the menu is open, no option matches, and a source is still loading or failed to load, so it can't send a half-typed mention; Escape closes the menu and Enter sends again. A failed refetch shows the retry message in a live status region and keeps the cached agents usable. While the workspace agents are unknown (the chat endpoint omits them on a load failure, or a new chat's selected workspace isn't pinned yet), every stored name is tier-qualified.
  • Selecting replaces the @ text with Delegate to the <name> agent (spawn_agent type <name>): and puts the caret at the end. It is a text instruction, not a new API field.
  • The plugin lives in fork files. The upstream ChatMessageInput.tsx change is one import and one element. It reads the workspace subagents from the chat query the page already loaded, without fetching it again.
  • Docs: three sentences in the custom agent section of the pstack adapter doc and one source reference line.

Tests: 13 plugin tests: choosing a built-in type replaces the mention with the delegation; ArrowDown and Enter insert the highlighted option; an @ inside a word opens nothing and the definitions load only once the menu opens; a name that a stored and a workspace source both define is qualified; stored names are qualified while the workspace agents are unknown, and in a new chat with a selected workspace; Enter doesn't send while agents load; after a load failure Enter doesn't send until Escape closes the menu; a failed refetch keeps the cached agents selectable; @ stays text in a general child without fork-nested-subagents and in a custom child; a nested child lists its root chat's project agents; / still opens the skills menu. Breaking the spawn gate, the root project lookup, the Enter handler (loading, error, or menu-open check), the unknown workspace list or the error state each fails its test. The portal and ARIA wiring were checked live (UAT round 1, s1). 4 menu stories cover the list, empty, loading and load error states.

Checks: tsc, biome, oxlint, knip, lint:check, lint:compiler, lint:circular-deps, unit tests (128 in ChatMessageInput) and story tests (74) pass locally.

Known limits: clicking outside the menu doesn't close it (Escape or moving the caret does), and computer_use is never offered because it is a reserved name.

UAT on the fork UI UAT server (local Vite at head 1dde946e22 proxying to it, member account), 4 of 4 pass:

  • In the new-chat composer, @ lists the built-ins and the member's personal definitions above the composer, the editor's ARIA attributes point at the highlighted option, and choosing @uat-w10-mention inserts the delegation.
  • Sending it makes the model spawn a child with agent_type uat-w10-mention.
  • In that child, with fork-nested-subagents on, @exp opened the menu. A later review fix hides the menu in custom children, so this now stays text; a unit test covers it.
  • An @explore delegation spawns an explore child, and in it @exp stays plain text with no menu.

Not tested live: Enter while sources load, and a child chat's root project, because no chat on the server has a project. Unit tests cover both.

…nt names case-insensitively and trim mention stories
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum commented on behalf of @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T10:14:51.783339Z 012aee7 Draft marked ready
ℹ️ 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 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: 1e2f4c5280

ℹ️ 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".

…t mentions on spawn ability and wire menu a11y

Hide the @ menu in child chats that cannot spawn, use the root chat's
project in child chats, hold Enter while agents load, render the options
inside Lexical's listbox with its ids, and restore the Range prototype
after the test suite.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum commented on behalf of @ibetitsmike.

@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: 1dde946e22

ℹ️ 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 docs/fork/pstack-adapter.md Resolved
Comment thread docs/fork/pstack-adapter.md Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum commented on behalf of @ibetitsmike.

@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: 67860508db

ℹ️ 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".

…r on agent load errors, qualify names while workspace agents are unknown
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum commented on behalf of @ibetitsmike.

@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: 6cf17e0fc1

ℹ️ 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".

…gent names while a selected workspace is not pinned
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum commented on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 012aee744d

ℹ️ 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".

@ibetitsmike
ibetitsmike marked this pull request as ready for review November 11, 2026 10:02
@ibetitsmike
ibetitsmike merged commit cc347a2 into main Nov 11, 2026
11 checks passed
@ibetitsmike
ibetitsmike deleted the mike/agent-usage-4-mention branch November 11, 2026 10:11
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum merged this PR on behalf of @ibetitsmike.

Merged at cc347a2ee7 (squash of head 012aee744d).

  • CI: fork-ci run 42999415596 green on the exact head, which contained main 857d342b62.
  • Codex: receipt 6792866362 on 012aee744d, no major issues. 0 unresolved threads.
  • UAT: 4/4 passed on 1dde946e22 on the 3100 test server (root menu and accessibility wiring, a live spawn of a custom type, nesting in a custom child, no menu in an explore child). The Codex fixes since then (refetch errors, status announcements, @ only where the child can spawn, Enter held while loading or on errors, qualified names while workspace agents are unknown) are covered by unit tests with negative controls.

Part of #187.

@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: 012aee744d

ℹ️ 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".

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