Skip to content

Gateway: add commands.list method#17054

Closed
advaitpaliwal wants to merge 2 commits into
openclaw:mainfrom
advaitpaliwal:gateway-commands-list
Closed

Gateway: add commands.list method#17054
advaitpaliwal wants to merge 2 commits into
openclaw:mainfrom
advaitpaliwal:gateway-commands-list

Conversation

@advaitpaliwal

@advaitpaliwal advaitpaliwal commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem: Web hook currently needs to hit an orchestrator HTTP route to list chat commands.
  • Why it matters: We want the web hook to call through the gateway WebSocket instead, and delete the HTTP route.
  • What changed:
    • Added gateway WS method commands.list that returns the chat command registry.
    • The payload now includes args[] (when present) and normalizes static choices values to { value, label } pairs.
    • Wired it into method discovery + read-scope allowlists.
  • What did NOT change (scope boundary): No changes to web hook wiring, no removal of the existing orchestrator HTTP route yet.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Related: (follow-up PR will remove orchestrator HTTP route)

User-visible / Behavior Changes

  • Adds gateway WS method commands.list (read-scoped) and includes it in the gateway method list.
  • commands.list now returns command args and static arg choices (dynamic/function choices are omitted).

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 22+

Steps

  1. Call gateway WS method commands.list as an operator client with operator.read.

Expected

  • Returns an array of command descriptors, including args and static choices.

Evidence

  • Passing tests: pnpm build && pnpm check && pnpm test

Human Verification (required)

  • Verified scenarios: unit test for scope gating + payload mapping (src/gateway/server-methods/commands.test.ts).
  • Edge cases checked: fallback name to key, fallback category to general, and normalization of string choices.
  • What you did not verify: manual web hook integration (done in follow-up).

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)

Failure Recovery (if this breaks)

  • Revert commit(s) that introduce/extend commands.list.

Risks and Mitigations

  • Risk: exposing a method without correct scoping.
    • Mitigation: commands.list is in READ_METHODS with a unit test verifying operator.read is required.

AI-assisted disclosure

This PR was authored with AI assistance (Codex). Tests were run locally.

Greptile Summary

Added gateway WebSocket method commands.list that returns chat command registry metadata. The method is properly scoped to operator.read, included in gateway method discovery, and normalizes command args by:

  • Using nativeName as fallback to key for the command name
  • Defaulting missing category to "general"
  • Converting static string choices to { value, label } pairs
  • Filtering out dynamic/function choices (sets to undefined)

The implementation includes comprehensive test coverage verifying scope gating and payload mapping. No changes to web hook wiring or orchestrator HTTP route removal (intentionally deferred to follow-up PR).

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is clean, well-tested, and follows existing patterns. Scope gating is correctly implemented, the method is read-only (no side effects), and test coverage verifies both authorization and payload mapping. The changes are additive (no breaking changes) and properly integrate with the existing gateway method registration system.
  • No files require special attention

Last reviewed commit: 2fdbe86

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Feb 15, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels Feb 22, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Mar 14, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #pr-thunderdome-dangerzone on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime size: S stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants