Skip to content

fix(cli): validate ui.tools against the daemon's real tool surface - #1752

Merged
agentiknet merged 1 commit into
mainfrom
fix/validate-known-daemon-tools
Oct 7, 2026
Merged

agentiknet merged 1 commit into
mainfrom
fix/validate-known-daemon-tools

Conversation

@agentiknet

Copy link
Copy Markdown
Contributor

Problem

agentproto app validate, and through it agentproto catalog verify, checked an app's ui.tools against KNOWN_NON_APP_TOOLS, a hand-kept list of 21 daemon tools in the CLI. agentproto/apps#2 (session-chat@0.1.0) fails on ~40 real daemon tools: adapter_list, catalog_models, session_queue_*, session_artifact_*, device_*, agent_set_model, ...

Fix, at the source

  • DAEMON_TOOL_NAMES (packages/runtime/src/daemon-tool-names.generated.ts, exported as @agentproto/runtime/daemon-tool-names): 264 names, generated from a real gateway's tools/list.
  • Generator = guard (src/__tests__/daemon-tool-names.test.ts):
    • It boots a gateway in an isolated HOME (nothing persisted). Every optional dependency agentproto serve wires is stubbed, because several families only register when theirs is present: the workflow runner for workflow_*, the pairing/host registry for pair_* and device_*, join_token_*, inbound_watcher_*. The llm-endpoint tools are registered on a scratch server, so no sidecar starts.
    • It then requires the generated list to equal the registered tools. A missing name fails, and so does a stale one.
    • pnpm --filter @agentproto/runtime gen:daemon-tool-names regenerates the file (same test with UPDATE_DAEMON_TOOL_NAMES=1).
  • CLI: app validate accepts app_* (unchanged) plus any DAEMON_TOOL_NAMES entry. The error message no longer dumps the list.
  • Cross-check: every tool name declared statically in packages/runtime/src and packages/mcp-server/src (208, via server.tool( / registerTool() is in the generated list.

Tests

  • New runtime test (equality, stable across runs) and a new CLI test: session-chat's tool surface validates clean. The existing unknown-tool and stage-board tests still pass (workflow_status / workflow_escalation_resolve were missing until the workflow runner was wired, which this test now guards).
  • agentproto app validate projects/agent-apps/session-chat (agentik-studio) with this CLI: ok: true, no findings.
  • @agentproto/runtime: 6075 passed; mcp-events-e2e (known timing flake) failed once and passes alone.
  • @agentproto/cli: 1569 passed; resolve.test.ts > jcode needs adapter-jcode built locally (unrelated).
  • check-types clean (runtime, cli). Docs: docs/cli/verbs/app.md.

Release

agentproto/apps CI runs npm install -g @agentproto/cli@latest, so apps#2 only goes green after this is in an npm release.

app validate (and so catalog verify) checked ui.tools against a hand-kept
list of 21 daemon tools, so session-chat's allowlist (adapter_list,
session_queue_*, device_*, session_artifact_*, ...) failed with unknown
tool although every name is a real daemon tool.

The runtime now exports DAEMON_TOOL_NAMES (@agentproto/runtime/
daemon-tool-names), generated from a booted gateway's tools/list with
every optional surface wired (workflow runner, pairing/devices, join
tokens, llm-endpoint, ...). A runtime test boots the same gateway and
fails when the list and the registered tools differ in either direction;
pnpm --filter @agentproto/runtime gen:daemon-tool-names regenerates it.

@ponytail-coder ponytail-coder Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

Replaces the CLI's hand-kept ui.tools allowlist with a generated DAEMON_TOOL_NAMES list, exported from @agentproto/runtime/daemon-tool-names. A runtime test boots a real gateway and keeps the list exact. The previously hand-listed names workflow_escalation_resolve and workflow_status are still in the generated list.

Changeset

package bump reason
@agentproto/runtime minor new ./daemon-tool-names export
@agentproto/cli patch validation now uses the generated list

The PR already ships .changeset/validate-daemon-tool-names.md with these bumps, so I'm not adding another.

Findings

Observations

  • packages/runtime/src/__tests__/daemon-tool-names.test.ts: the test compares against a real tools/list, so drift fails CI and the error message gives the regen command. The test also checks the file text against render(actual), so the formatting stays deterministic. That is a good guard.
  • packages/runtime/tsup.config.ts and packages/runtime/package.json: the new entry and export map are consistent. The CLI already depends on @agentproto/runtime via workspace:*.
  • packages/cli/src/commands/app-init.ts: a tool added in a newer daemon is rejected by an older CLI. The docs and the error message both say so, which is acceptable.
  • I read the diff only and did not run the tests or the build.

Verdict

LGTM ✅. The change is small, tested and documented.


🤖 @agentproto-bot — review · session sess_b3c39c16 (wf:agentproto-pr-review/review) · claude-sdk / subscription · model claude-sonnet-5-5 · e2b ib3js6t40kad5dud1mavo · $0.0960 · run 37507993334 · sha 288bc1a0caa310a2933028ba969f562c481e6f1c

@agentiknet

Copy link
Copy Markdown
Contributor Author

@copilot see why that fails

Copilot AI commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@copilot see why that fails

The failed PR check is a flaky timing assertion, not a failure in this PR’s changes. In CI run 37507993334, the only failing test is cron-turn-observer.test.ts > ... > classifies no turn-end within the bound as timeout: it correctly gets outcome: "timeout", but reports durationMs as 29 for a 30 ms timeout, tripping toBeGreaterThanOrEqual(30) at line 121. That test file is unchanged by this PR. The Build + test failure is just the aggregator reflecting that test shard failure.

@agentiknet
agentiknet merged commit 1e758e6 into main Oct 7, 2026
15 of 17 checks passed
@agentiknet
agentiknet deleted the fix/validate-known-daemon-tools branch October 8, 2026 23:21
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.

2 participants