Repository navigation
Conversation
…erarchy A tool call whose arguments dict has a non-string key reached header sanitising and failed with an AttributeError on key.startswith(). It is not a JSON object, so it now raises ToolArgumentsError with the existing message, before any request. Account discovery read each GET /accounts entry with .get() and took any truthy id, so a non-dict entry raised AttributeError and a numeric id became an account id. fetch_accounts() already skips such entries when it records end users and providers; discovery now does the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
…tracts
The two docstrings narrated the old failure ("failed with an AttributeError").
They now say what the code guarantees. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
A list of entries that are not objects now reads as no linked accounts, and the inactive count leaves those entries out. toolset.execute() refuses non-string argument keys with ToolsetConfigError, as its docstring promises, rather than letting the inner execute tool raise under its own name, and the error says the keys must be strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
Contributor
Author
|
@willleeney a nudge on this one when you have a moment. Why it should be a quick review: +49 -7 across 4 files, CI green on the current head, forge and /code-review already run, no open review threads. It only needs an approving review to merge. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
StackOneTool._parse_argumentsraisesToolArgumentsError("Tool arguments for {tool} must have string keys") when the arguments dict has a non-string key, andStackOneToolSet.execute()raisesToolsetConfigError("arguments must have string keys") for the same input.StackOneToolSet._fetch_active_account_idsignoresGET /accountsentries that are not objects, and only treats a non-empty stringidas an active account.Why
Both paths could raise an
AttributeError, which escapes theStackOneErrorhierarchy CLAUDE.md promises for every public method:tool.execute({1: "x"})reached_sanitise_header_arguments, which callskey.startswith("headers_")on every top-level key. The nestedheaderspath already skipped non-string keys; the top level did not.a.get(...), so a non-dict entry in the list crashed, and any truthy id (for example5) was taken as an account id and sent asx-account-id.fetch_accounts()already skips such entries withisinstanceguards when it records end users and providers; discovery now does the same.tool.execute({1: "x"})AttributeError: 'int' object has no attribute 'startswith'ToolArgumentsError["junk", {"id": 5, "status": "active"}, {"id": "acc", "status": "active", ...}]AttributeError: 'str' object has no attribute 'get'["acc"]["junk", None]AttributeErrorToolsetConfigError: This API key has no linked accounts. ...The two "must have string keys" messages are new and are not added to
tests/vectors/messages.json, so the shared message vectors are unchanged.How verified
mainwithAttributeErrorand pass here.uv run ruff check .,uv run ruff format --check .,uv run ty check stackone_ai examples: clean.uv run pytest(Python 3.13, MCP mock via pnpm): 874 passed.Gates (head f27f683)
toolset.execute()refuses non-string keys withToolsetConfigErroras its docstring promises, and the error says the keys must be strings. Declined 4: nested keys serialise throughjson.dumpsas on main, the check stays at parse time (the contract every tool shares), the search/execute double parse is unchanged from main, and the test that asserted the old count is updatedRequested by guillaume@stackone.com in Slack (repo audit thread)
🤖 Generated with Claude Code
Summary by cubic
Fixes two paths where malformed input crashed with
AttributeErrorinstead of raising aStackOneError.ToolArgumentsError(fromtool.execute()) orToolsetConfigError(fromtoolset.execute()) instead of crashing during header sanitising.GET /accountsresponses; malformed entries are left out of the inactive-account count, and a list of only such entries reads as "no linked accounts".The two "must have string keys" messages are new and are not added to the shared message vectors.
Written for commit 4f3aeac. Summary will update on new commits.