Skip to content

Reject registerTool() promise when signal is aborted#202

Open
beaufortfrancois wants to merge 2 commits into
webmachinelearning:mainfrom
beaufortfrancois:promise-signal
Open

Reject registerTool() promise when signal is aborted#202
beaufortfrancois wants to merge 2 commits into
webmachinelearning:mainfrom
beaufortfrancois:promise-signal

Conversation

@beaufortfrancois

@beaufortfrancois beaufortfrancois commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

I believe we should reject registerTool() promise when signal is aborted instead now following #200 changes

It's part of changes required for #175.


Preview | Diff

@beaufortfrancois beaufortfrancois changed the title Reject registerTool() promise if signal is aborted Reject registerTool() promise if signal is already aborted Jun 9, 2026
@beaufortfrancois

Copy link
Copy Markdown
Contributor Author

@domfarolino Please review

Comment thread index.bs Outdated
1. If |signal| is [=AbortSignal/aborted=], then return [=a promise rejected with=]
|signal|'s [=AbortSignal/abort reason=].

1. [=AbortSignal/add|Add an abort algorithm=] to |signal| that [=model context/unregisters a

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I also need to reject promise when tool gets unregistered but it's not clear to me how to do this properly. Should I add |promise| and |signal| parameters to the "unregister a tool" algorithm or should I call both reject promise and then unregister tool algorithm?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I gave it a shot. Please let me know if that looks good to you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

One thing I'm still not sure is whether we want "Notify documents of a tool change" to run before rejecting the promise when signal is aborted.

@beaufortfrancois beaufortfrancois changed the title Reject registerTool() promise if signal is already aborted Reject registerTool() promise when signal is aborted Jun 9, 2026
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