Skip to content

test: cover gateway policy toolset and reply caps - #179

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/missing-test-coverage-32e9
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/missing-test-coverage-32e9

Conversation

@cursor

@cursor cursor Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Risky behavior now covered

  • The gateway agent registers GatewayPolicy.tools_enabled, so a project tools_enabled: "all" does not expose terminal, write_file, or git_commit on the shared gateway agent. gateway.tools_enabled: "all" still opens that full set, including git_commit, over a narrow top-level list.
  • A public-platform denial from GatewayPolicy.allows logs gateway denied <platform> chat=… user=….
  • Discord REST replies and Twitch PRIVMSG bodies stay within the adapter's declared max_reply_chars. A Twitch split that would start the next chunk with /me is stripped before send.
  • Telegram splitting uses the adapter's split_text (the copy sendMessage calls) and hard-cuts a token with no whitespace at TELEGRAM_CAPABILITIES.max_reply_chars.

Test files added/updated

  • test/gateway.test.ts
  • test/gateway_reconnect.test.ts

Why these tests materially reduce regression risk

#178 declared the policy and the per-platform caps, and the existing tests checked the policy object and the capability literals. They did not run create_gateway_bus, so dropping the tools_enabled override would still leave terminal and git_commit on a public gateway while those tests stayed green. Discord and Twitch chunking is private and was untested; Telegram tests imported format.ts split_text, which the adapter does not call. A cap regression would post over-length Discord messages or a Twitch chat command created by a mid-string cut.

Validation: node node_modules/vitest/vitest.mjs run test/gateway.test.ts test/gateway_reconnect.test.ts (52 passed) and bun x tsc --noEmit. The full suite was not run; known failures remain in tests that spawn bun or need dist/.

Open in Web View Automation 

create_gateway_bus applies GatewayPolicy.tools_enabled over a wider
top-level list, and gateway.tools_enabled "all" still exposes terminal,
write_file, and git_commit. Discord and Twitch outbound replies stay
within the declared cap, including a Twitch cut that would start the
next chunk with /me. Telegram split tests call the adapter's splitter.

Co-authored-by: moikapy <[email protected]>

This branch has not been deployed

No deployments
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