Skip to content

fix(computer-use): add set_value to ComputerUseBackend ABC and _NoopBackend stub (#22748) - #30270

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-02d0efaa
May 22, 2026
Merged

teknium1 merged 2 commits into
mainfrom
hermes/hermes-02d0efaa

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Salvages #22748 onto current main. Closes a contract gap on the ComputerUseBackend ABC.

The problem

_dispatch() in tools/computer_use/tool.py already routes set_value to backend.set_value(...), but set_value was never declared on the ComputerUseBackend ABC and was missing from the _NoopBackend test stub.

Consequences:

  • Concrete backends that forget to implement set_value pass subclass validation silently — Python's ABC enforcement only fires when a method is declared @abstractmethod.
  • In test mode, any handler exercising set_value raises AttributeError on _NoopBackend with no useful diagnostic.

The fix

  • tools/computer_use/backend.pyset_value declared as @abstractmethod. Concrete backends missing the impl now TypeError at construction time, exactly like every other action verb.
  • tools/computer_use/tool.py_NoopBackend.set_value records the call for test inspection (same shape as the other stub methods).
  • tests/tools/test_computer_use.pytest_set_value_routes_to_backend verifies dispatch carries the args; test_set_value_missing_value_returns_error verifies missing value returns an error dict without raising.

Validation

Credit @rodrigoeqnit (PR #22748).

Closes #22748.

Infographic

pr-22748-set-value-abc

Rodrigo and others added 2 commits May 21, 2026 23:47
…ackend stub

_dispatch() routes action="set_value" to backend.set_value(), but:
- ComputerUseBackend did not declare set_value as @AbstractMethod, so
  subclasses could silently omit it without a TypeError at class load time.
- _NoopBackend (the test/CI stub) had no set_value method at all, causing
  AttributeError in any test that exercises the set_value action path.

Fix:
- Add set_value as @AbstractMethod to ComputerUseBackend in backend.py.
- Add a recording stub in _NoopBackend in tool.py.
- Add two TestDispatch cases: one verifying the call reaches the backend,
  one verifying the missing-value guard returns a clean error.
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-02d0efaa vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9012 on HEAD, 9013 on base (✅ -1)

🆕 New issues: none

✅ Fixed issues (1):

Rule Count
unresolved-attribute 1
First entries
tools/computer_use/tool.py:400: [unresolved-attribute] unresolved-attribute: Object of type `ComputerUseBackend` has no attribute `set_value`

Unchanged: 4763 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists labels May 22, 2026
@teknium1
teknium1 merged commit 07b7cf6 into main May 22, 2026
19 of 20 checks passed
@teknium1
teknium1 deleted the hermes/hermes-02d0efaa branch May 22, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants