Repository navigation
test(desktop): exempt the get_screenshot alias from the tool-declaration check - #12705
Conversation
…ion check
`ChatDiscoverabilityTests.testDesktopCapabilitiesExistInAgentToolDeclarations` fails on
`main`, in isolation:
XCTAssertTrue failed - Missing agent tool declaration for look_at_frame
`look_at_frame` is not a tool of its own. `omi-tool-manifest.ts` declares it inside
`get_screenshot`'s `aliasCapabilityDocs`, and `LocalAgentAPIServer.swift:318` maps it
straight back:
let canonicalToolName = toolName == "look_at_frame" ? "get_screenshot" : toolName
Both capability docs state "Local API only", so it is never advertised to the `pi-mono`
or `omi-tools-stdio` adapters the assertion reads — exactly like `get_screenshot`, which
the exemption list already covers.
The alias reached `DesktopCapabilityRegistry` in BasedHardware#12084 (2026-08-27); the exemption list
had not been touched since 2026-08-01, so the assertion has failed since that merge.
Adding the canonical name's alias to the same list is the narrow fix. Deriving aliases
instead would be better, but the alias relationship lives in the TypeScript manifest and is
not carried into `GeneratedToolCapabilities.swift`, so there is nothing to derive from on
the Swift side without changing the generator.
Verification: 23/23 in the suite. Mutation-checked — dropping `get_local_status` from the
same list fails the assertion with `Missing agent tool declaration for get_local_status`,
so the check still has teeth and this is an exemption, not a disablement.
Failure-Class: none
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 5/5
desktop/macos/Desktop/Tests/ChatDiscoverabilityTests.swiftrelies on a hardcoded exemption list that can become stale when aliases or manifest entries change, causing avoidable test failures and manual maintenance; keep the list synchronized or make the test derive exemptions from the manifest.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="desktop/macos/Desktop/Tests/ChatDiscoverabilityTests.swift">
<violation number="1" location="desktop/macos/Desktop/Tests/ChatDiscoverabilityTests.swift:207">
P3: The hardcoded exemption list is exactly what broke this test: it went stale between 2026-08-01 and the alias landing in #12084, turning a manifest change into a failing test that needed a manual list edit. The test already computes `declaredTools` from the same fixture, so it can derive the exempt set instead of maintaining it by hand: a `desktopToolNames` entry that is not in `declaredTools` should be exempt only when the manifest marks its executor kind `localApiOnly` (i.e. it is advertised only on `local-agent-api` and not `pi-mono`/`omi-tools-stdio`, and is not `runtimeControl`). Deriving the set from the fixture makes the assertion robust to future aliases/local-only tools and prevents this whole failure class from recurring, rather than patching the symptom each time the manifest changes.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| // for the same reason its canonical name is. It reached the registry in #12084 | ||
| // (2026-08-27) while this list had not changed since 2026-08-01, which is why the | ||
| // assertion below has failed ever since. | ||
| let localApiOnlyTools: Set<String> = ["get_local_status", "get_screenshot", "look_at_frame"] |
There was a problem hiding this comment.
P3: The hardcoded exemption list is exactly what broke this test: it went stale between 2026-08-01 and the alias landing in #12084, turning a manifest change into a failing test that needed a manual list edit. The test already computes declaredTools from the same fixture, so it can derive the exempt set instead of maintaining it by hand: a desktopToolNames entry that is not in declaredTools should be exempt only when the manifest marks its executor kind localApiOnly (i.e. it is advertised only on local-agent-api and not pi-mono/omi-tools-stdio, and is not runtimeControl). Deriving the set from the fixture makes the assertion robust to future aliases/local-only tools and prevents this whole failure class from recurring, rather than patching the symptom each time the manifest changes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Tests/ChatDiscoverabilityTests.swift, line 207:
<comment>The hardcoded exemption list is exactly what broke this test: it went stale between 2026-08-01 and the alias landing in #12084, turning a manifest change into a failing test that needed a manual list edit. The test already computes `declaredTools` from the same fixture, so it can derive the exempt set instead of maintaining it by hand: a `desktopToolNames` entry that is not in `declaredTools` should be exempt only when the manifest marks its executor kind `localApiOnly` (i.e. it is advertised only on `local-agent-api` and not `pi-mono`/`omi-tools-stdio`, and is not `runtimeControl`). Deriving the set from the fixture makes the assertion robust to future aliases/local-only tools and prevents this whole failure class from recurring, rather than patching the symptom each time the manifest changes.</comment>
<file context>
@@ -198,7 +198,13 @@ final class ChatDiscoverabilityTests: XCTestCase {
+ // for the same reason its canonical name is. It reached the registry in #12084
+ // (2026-08-27) while this list had not changed since 2026-08-01, which is why the
+ // assertion below has failed ever since.
+ let localApiOnlyTools: Set<String> = ["get_local_status", "get_screenshot", "look_at_frame"]
for toolName in DesktopCapabilityRegistry.desktopToolNames where !localApiOnlyTools.contains(toolName) {
</file context>
… fixture Replaces the hardcoded exemption list added in the previous commit. Review was right that the list is the defect, not the missing entry: it went stale between 2026-08-01 and the alias landing in BasedHardware#12084, which is what turned a manifest addition into a red test. I had claimed deriving was not possible. That was wrong, and I checked the wrong artifact — `GeneratedToolCapabilities.swift` does not carry alias data, but this test does not read it. It reads `agent/tests/fixtures/tool-manifest.json`, which carries both halves: get_screenshot: executor.kind = localApiOnly, aliases = ["look_at_frame"] get_local_status: executor.kind = localApiOnly So the exempt set is now computed from the fixture: a tool marked `localApiOnly`, plus any alias inheriting its canonical entry's exemption. Nothing is hand-maintained, and the next Local-API-only tool or alias is covered without editing this file. An `XCTAssertFalse(localApiOnlyTools.isEmpty)` guards the derivation itself, so a fixture that stopped marking executor kinds would fail loudly rather than silently exempting nothing — which is the failure mode a derived set introduces and a literal list does not. Verification: 23/23. Mutation-checked twice — dropping alias inheritance fails with `Missing agent tool declaration for look_at_frame`, and (on the previous commit) dropping a canonical name fails with its own missing-declaration error, so the assertion still has teeth in both directions. Failure-Class: none
Git-on-my-level
left a comment
There was a problem hiding this comment.
Verified the core fix — this exemption is correct, and the mutation check is genuine.
- In
agent/tests/fixtures/tool-manifest.json,look_at_frameappears only as an alias onget_screenshot("adapters": {"local-agent-api": {"advertised": true, "aliases": ["look_at_frame"]}}). The test only collects names advertised viapi-mono/omi-tools-stdioor withruntimeControlexecutors, solook_at_framecan never land indeclaredTools— whileGeneratedToolCapabilities.swiftdoes register it as a.desktopChatcapability, so the assertion fails onmainexactly as described. - I re-derived the loop statically against the fixture and the generated registry: with the old two-name list,
look_at_frameis the only missing name; with your three-name list, zero; droppingget_local_statusinstead reportsget_local_status. The check keeps its teeth — this is an exemption, not a blanket pass. LocalAgentAPIServer.swift:318mappinglook_at_frame→get_screenshotchecks out, as does the{"kind": "none"}fragment percheck-desktop-changelog.py's accepted fragment kinds.
One correction needed before merge, though: the history recorded in the added comment (and the PR body) doesn't match what the repo shows.
- "It reached the registry in #12084 (2026-08-27)" — #12084 created the backend
look_at_frametool (backend/utils/retrieval/tools/frame_request_tools.py); its diff contains nodesktop/macosfiles at all. On the desktop side,git log -S 'look_at_frame' -- desktop/macosreturns a single commit: the #12469 merge (e1eca38ff2, 2026-08-31), which is whereGeneratedToolCapabilities.swiftpicked up the entry. - "this list had not changed since 2026-08-01 … the assertion below has failed ever since" — the test file itself (with the two-name list) landed in that same #12469 merge, i.e. the assertion has been red since birth (~4 days), not since 2026-08-27.
Since the comment's entire job is to record why the exemption exists, pointing at the wrong PR and dates will misdirect the next person who greps here. Could you update those lines to the #12469 / 2026-08-31 born-red story (and the PR body table to match)? The one-line exemption itself can land unchanged.
No maintainer escalation needed — once the comment matches the history this is a straightforward merge; the diagnosis of why the exemption is correct (alias of a Local-API-only tool) stands.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
kodjima33
left a comment
There was a problem hiding this comment.
Correct, narrow fix for a test assertion that's been red on main since the look_at_frame alias landed (#12469/#12084). Bug-fix fast-lane score is 2/5 (small diff + symptom described, but no fix/bug title vocabulary, no bug label, title doesn't start with fix(desktop)) so holding at approve rather than owner-override merge.
|
I checked the history against the repo before changing the comment, and it holds as written — so I'd rather not edit it to the #12469 story, because that would put an incorrect history into the file the comment exists to explain. Three claims, each re-derived on current 1. #12084 does touch
2. The alias search returns #12084, not #12469. Same single commit for I suspect the empty result came from the path: the file is under For completeness, 3. The test file predates the alias by nearly four weeks, and was green for all of it. So the two-name list landed 2026-08-01 and was correct on the day it was written — That is the story the comment already tells, so I've left it and the PR body unchanged. Happy to be shown otherwise if you're reading a different commit than On the separate cubic P3 (derive the exemptions instead of listing them): I agree it is the better design and said so in the PR body. The blocker is that the alias relationship exists only in the TypeScript manifest and is not carried into |
|
My earlier history objection was wrong — @aryanorastar, your rebuttal checks out and the comment stands as written. Withdrawing that request; from automation's side this is merge-ready under the recorded approval. I re-derived the history independently (content-at-ref, not path-filtered logs) before replying:
For the record, where my earlier claim came from, since it's a failure mode worth remembering when auditing large squash merges: the commit API's file listing caps at 300 entries and #12084 has exactly 300, so its Everything else from my earlier review stands unchanged: in Thanks for pushing back with receipts rather than editing a correct comment to match a wrong review — that was exactly the right call, and it kept the repo's recorded history accurate. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Appreciated — and the root cause you found is the more useful half of this. The GitHub commit API capping its file listing at 300 entries, with #12084 landing on exactly 300, is a genuinely nasty auditing trap: the response looks complete, there is no truncation marker in what you read, and "no The lesson I am taking from it is the one you applied — content-at-ref beats path-filtered history. On the merge state: the formal |
…ity-look-at-frame-alias One conflict, and main has since made this PR's original purpose redundant. 8234c83 (BasedHardware#12607) landed the three-name exemption list on main, so the red ChatDiscoverabilityTests assertion this branch opened to fix is already green there. What remains is the derivation this branch added afterwards, which is a different thing: it computes the exempt set from agent/tests/fixtures/tool-manifest.json instead of restating it as a literal, so the list cannot go stale again. Kept the derivation and carried main's rationale into its comment -- main states the reason more clearly than the original did (the local API is the only adapter either name is advertised to, so neither can appear in a chat adapter's declarations), and that reasoning is worth keeping whichever way the set is built. Verified the derivation against main's own fixture rather than assuming the shape survived: localApiOnly entries are get_local_status (no aliases) and get_screenshot (aliases ['look_at_frame']), so the derived set is exactly {get_local_status, get_screenshot, look_at_frame} -- byte-identical in effect to main's literal, and computed rather than maintained.
|
Merged current The scope of this PR changed while it was open, and the description now says so up front. The conflict was this file, and I kept both sides' intent. Equivalence verified against Exactly
One correction carried into the description. My earlier reply said deriving was not possible because Only remaining gate is the recorded |
kodjima33
left a comment
There was a problem hiding this comment.
Test-only hardening (derives Local-API-only exemption set from the tool-manifest fixture instead of a hand-maintained list) — bug-fix heuristic scores 2/5 (small surgical diff + clear before/after symptom description, but no fix/bug title vocabulary or bug label), below the 3/5 desktop fast-lane bar. Original red-assertion bug it opened to fix is already independently fixed on main (#12607); this PR's remaining value is preventing recurrence. Nik already personally approved the substantive commit; only a trivial merge-from-main landed since. Approve only, not merging.
Dismissing as stale on head 9f43ab1: the sole objection in this review — the history attribution in the exemption comment — was withdrawn on 2026-09-05 after the history was independently re-derived from content-at-ref (the original claim came from a truncated 300-file commit-API listing). The exemption itself was verified correct on both heads, and the current head replaces the literal list with a fixture-derived equivalent set; an approval is already recorded on this head.
|
Verified on the current head (
The recorded CHANGES_REQUESTED is dismissed below: its sole objection — the history attribution in the exemption comment — was withdrawn on 2026-09-05 after the history was re-derived from content-at-ref (the objection had come from a truncated 300-file commit listing). With that cleared and the approval already recorded on this head, nothing further is needed from review's side; the merge call stays with a maintainer. by AI on behalf of David — no escalation needed. |
What this does now
ChatDiscoverabilityTests.testDesktopCapabilitiesExistInAgentToolDeclarationscomputes its Local-API-only exemptions fromagent/tests/fixtures/tool-manifest.json— the same fixture the assertion already reads — instead of carrying a hand-maintained list:A tool is exempt when the manifest marks it Local API only; an alias inherits its canonical entry's exemption.
Why it is still worth landing
The hardcoded list is what broke the test.
look_at_framereached the desktop registry in #12084 on 2026-08-27 while the list had not changed since 2026-08-01, so a manifest addition became a red assertion — and stayed red until #12607 hand-edited the list again. Deriving it means the next Local-API-only tool or alias needs no edit here at all.This was cubic's P3 on the original head, and it was right. My reply at the time said deriving was not possible because
GeneratedToolCapabilities.swiftcarries no alias data. That was wrong — this test does not read that file. It reads the fixture, which carries both halves:Guard on the derivation itself
XCTAssertFalse(localApiOnlyTools.isEmpty, ...)fails loudly if the fixture ever stops marking executor kinds. That is the failure mode a derived set introduces and a literal does not — an empty derivation would silently exempt nothing and pass.Verification
Equivalence checked against
main's own fixture rather than assumed:Exactly
main's literal list, computed instead of maintained.swift test --filter ChatDiscoverabilityTests— 25 passed, 0 failuresMissing agent tool declaration for look_at_frame; dropping a canonical name fails with its own missing-declaration error. The assertion has teeth in both directions.main(0 behind). The conflict was this file; I kept the derivation and carriedmain's comment rationale into it, since One chat shell: every content block renders everywhere, plus chat ergonomics (#12598) #12607 explains why the alias inherits better than the original text did.On the earlier history objection
Resolved: the reviewer withdrew it and confirmed the dates independently. Worth recording the cause, since it generalises — the GitHub commit API caps its file listing at 300 entries and #12084 has exactly 300, so its
desktop/macosfiles were silently dropped from the listing. "No desktop files in that commit" was truncation, not fact. Content-at-ref (git cat-file -e <ref>:<path>) cannot be truncated that way;log -S,--name-onlyand the commit API each can.Test-only.
{"kind": "none"}changelog fragment unchanged.Failure-Class: none