openclaw - ✅(Solved) Fix Gateway RPC: add SDK-facing task ledger APIs [2 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#74707Fetched 2026-04-30 06:20:55
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Author
Timeline (top)
cross-referenced ×3commented ×1

PR fix notes

PR #74815: feat(gateway): add task ledger RPCs

Description (problem / solution / changelog)

Summary

  • Problem: external App SDK clients have oc.tasks.* methods, but the Gateway does not expose SDK-facing task ledger RPCs, so the namespace cannot inspect or cancel background work.
  • Why it matters: apps and dashboards cannot discover queued/running/done task state or request cancellation through the public Gateway contract.
  • What changed: added typed tasks.list, tasks.get, and tasks.cancel RPCs backed by the existing task registry and cancellation executor, wired @openclaw/sdk task helpers, refreshed generated protocol artifacts, and documented the surface.
  • What did NOT change (scope boundary): no task event stream, no task creation API, no environment/runtime provisioning, and no change to task execution policy.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • 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

  • Closes #74707
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

N/A

  • Root cause: N/A
  • Missing detection / guardrail: N/A
  • Contributing context (if known): N/A

Regression Test Plan (if applicable)

N/A

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/gateway/server-methods/tasks.test.ts, src/gateway/protocol/index.test.ts, src/gateway/method-scopes.test.ts, packages/sdk/src/index.test.ts
  • Scenario the test should lock in: task RPC validation/filtering/get/cancel behavior, operator scopes, protocol schemas, and SDK dispatch to tasks.* instead of unsupported errors.
  • Why this is the smallest reliable guardrail: the new surface is an additive Gateway/SDK seam over existing task internals.
  • Existing test that already covers this (if any): N/A
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

External clients using @openclaw/sdk can now call oc.tasks.list, oc.tasks.get, and oc.tasks.cancel. Gateway clients can discover and call tasks.list, tasks.get, and tasks.cancel with existing operator scopes.

Diagram (if applicable)

Before:
App SDK oc.tasks.* -> unsupported error

After:
App SDK oc.tasks.* -> Gateway tasks.* RPC -> existing task registry/cancel executor -> task result

Security Impact (required)

  • New permissions/capabilities? (Yes/No) Yes
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) Yes
  • Data access scope changed? (Yes/No) Yes
  • If any Yes, explain risk + mitigation: tasks.list/tasks.get expose task ledger metadata only to authenticated operator clients with operator.read; tasks.cancel is gated by operator.write, matching existing run/session cancellation control.

Repro + Verification

Environment

  • OS: Linux
  • Runtime/container: Node 22 / pnpm repo scripts
  • Model/provider: N/A
  • Integration/channel (if any): Gateway + @openclaw/sdk
  • Relevant config (redacted): N/A

Steps

  1. Call oc.tasks.list({ status: ["queued", "running"] }) from an SDK client.
  2. Call oc.tasks.get("task-id") for a known task id.
  3. Call oc.tasks.cancel("task-id") for a cancellable task.

Expected

  • The SDK dispatches to tasks.list, tasks.get, and tasks.cancel.
  • Gateway returns task records with known agent/run/session relationships.
  • Cancellation returns a clear { found, cancelled, reason?, task? } result.

Actual

  • Before this change, the SDK task helpers threw unsupported errors and the Gateway had no tasks.* handlers.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: pnpm test packages/sdk/src/index.test.ts src/gateway/server-methods/tasks.test.ts src/gateway/protocol/index.test.ts src/gateway/method-scopes.test.ts; pnpm test src/gateway/server-methods/tasks.test.ts; pnpm protocol:check; pnpm tsgo:core; pnpm tsgo:test:src && pnpm tsgo:test:packages; git diff --check upstream/main..HEAD.
  • Edge cases checked: invalid task list params, status/agent/session/limit filtering, missing task get result, trimmed task id cancellation, operator read/write scope classification, generated protocol drift.
  • What you did not verify: a live Gateway task cancellation against a real long-running task.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: exposing task metadata through a new public RPC could reveal operational task labels to clients that previously could only observe sessions/runs.
    • Mitigation: read APIs require operator.read, and cancellation requires operator.write; no unauthenticated or node-role access is added.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • apps/macos/Sources/OpenClawProtocol/GatewayModels.swift (modified, +230/-0)
  • apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift (modified, +230/-0)
  • docs/concepts/openclaw-sdk.md (modified, +18/-4)
  • docs/gateway/protocol.md (modified, +1/-0)
  • docs/reference/openclaw-sdk-api-design.md (modified, +3/-3)
  • packages/sdk/src/client.ts (modified, +10/-9)
  • packages/sdk/src/index.test.ts (modified, +51/-9)
  • packages/sdk/src/index.ts (modified, +9/-0)
  • packages/sdk/src/types.ts (modified, +74/-0)
  • src/gateway/method-scopes.test.ts (modified, +3/-0)
  • src/gateway/method-scopes.ts (modified, +3/-0)
  • src/gateway/protocol/index.test.ts (modified, +54/-0)
  • src/gateway/protocol/index.ts (modified, +34/-0)
  • src/gateway/protocol/schema.ts (modified, +1/-0)
  • src/gateway/protocol/schema/protocol-schemas.ts (modified, +16/-0)
  • src/gateway/protocol/schema/tasks.ts (added, +121/-0)
  • src/gateway/protocol/schema/types.ts (modified, +7/-0)
  • src/gateway/server-methods-list.ts (modified, +3/-0)
  • src/gateway/server-methods.ts (modified, +2/-0)
  • src/gateway/server-methods/tasks.test.ts (added, +156/-0)
  • src/gateway/server-methods/tasks.ts (added, +120/-0)

PR #74847: feat(gateway): add SDK task ledger RPCs

Description (problem / solution / changelog)

Summary

  • Problem: @openclaw/sdk exposed oc.tasks.*, but list, get, and cancel still threw unsupported errors because Gateway had no SDK-facing task ledger RPCs.
  • Why it matters: OpenMeow and other app clients need stable task visibility for detached/background work without reading internal logs or CLI-only surfaces.
  • What changed: Added tasks.list, tasks.get, and tasks.cancel Gateway RPCs, SDK methods/types, protocol schemas, scopes, docs, and regression coverage.
  • What did NOT change (scope boundary): This does not add tool invocation, artifact APIs, environment provisioning, or new task runtime semantics.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • 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

Root Cause (if applicable)

  • Root cause: Gateway already had a durable task registry, but no public RPC contract or SDK bridge exposed it to external app clients.
  • Missing detection / guardrail: SDK coverage only locked in unsupported task errors instead of the app-client task ledger contract.
  • Contributing context (if known): The OpenMeow gap map calls out tasks.list, tasks.get, and tasks.cancel as missing basics.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this: Unit test and seam / integration test.
  • Target test or file: src/gateway/server-methods/tasks.test.ts, src/gateway/protocol/index.test.ts, packages/sdk/src/index.test.ts, packages/sdk/src/index.e2e.test.ts.
  • Scenario the test should lock in: SDK task methods route to Gateway RPCs, task statuses are app-facing and stable, filters work, scopes are classified, and cancel returns a clear result contract.
  • Why this is the smallest reliable guardrail: It exercises the protocol and SDK seams without requiring a live detached task runtime.
  • Existing test that already covers this (if any): Existing task registry tests cover the underlying task lifecycle.
  • If no new test is added, why not: N/A.

User-visible / Behavior Changes

oc.tasks.list(), oc.tasks.get(taskId), and oc.tasks.cancel(taskId) now call Gateway task ledger RPCs instead of throwing unsupported errors.

Diagram (if applicable)

Before:
[external app] -> [@openclaw/sdk oc.tasks.*] -> [unsupported error]

After:
[external app] -> [@openclaw/sdk oc.tasks.*] -> [Gateway tasks.* RPC] -> [durable task registry]

Security Impact (required)

  • New permissions/capabilities? (Yes/No) Yes
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) Yes
  • If any Yes, explain risk + mitigation: tasks.list and tasks.get require operator.read; tasks.cancel requires operator.write. The RPCs expose task metadata from the existing durable task registry and do not expose secrets.

Repro + Verification

Environment

  • OS: Ubuntu/Linux local workspace
  • Runtime/container: Node 22.22.0 via nvm, pnpm 10.33.2
  • Model/provider: N/A
  • Integration/channel (if any): Gateway WebSocket RPC / @openclaw/sdk
  • Relevant config (redacted): N/A

Steps

  1. On current main, call oc.tasks.list(), oc.tasks.get("task-id"), or oc.tasks.cancel("task-id").
  2. Observe the SDK unsupported error.
  3. Apply this PR.
  4. Call the same SDK methods against a Gateway with task records.

Expected

  • SDK task methods route to Gateway task ledger RPCs and return stable task summaries or cancel results.

Actual

  • Before this PR, SDK task methods throw unsupported errors.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Lint evidence:

  • git diff --check HEAD~1 HEAD
  • targeted oxlint on changed TS files
  • markdownlint-cli2 docs/concepts/openclaw-sdk.md

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: SDK-facing task statuses intentionally differ from internal registry statuses.
  • Mitigation: Tests lock in the public mapping, including succeeded to completed and lost to failed.

Changed files

  • apps/macos/Sources/OpenClawProtocol/GatewayModels.swift (modified, +214/-0)
  • apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift (modified, +214/-0)
  • docs/concepts/openclaw-sdk.md (modified, +12/-5)
  • packages/sdk/src/client.ts (modified, +13/-9)
  • packages/sdk/src/index.e2e.test.ts (modified, +54/-0)
  • packages/sdk/src/index.test.ts (modified, +64/-9)
  • packages/sdk/src/index.ts (modified, +6/-0)
  • packages/sdk/src/types.ts (modified, +50/-0)
  • src/gateway/method-scopes.test.ts (modified, +3/-0)
  • src/gateway/method-scopes.ts (modified, +3/-0)
  • src/gateway/protocol/index.test.ts (modified, +21/-0)
  • src/gateway/protocol/index.ts (modified, +31/-0)
  • src/gateway/protocol/schema.ts (modified, +1/-0)
  • src/gateway/protocol/schema/protocol-schemas.ts (modified, +16/-0)
  • src/gateway/protocol/schema/tasks.ts (added, +91/-0)
  • src/gateway/protocol/schema/types.ts (modified, +7/-0)
  • src/gateway/server-methods-list.ts (modified, +3/-0)
  • src/gateway/server-methods.ts (modified, +2/-0)
  • src/gateway/server-methods/tasks.test.ts (added, +167/-0)
  • src/gateway/server-methods/tasks.ts (added, +205/-0)
  • src/tasks/detached-task-runtime-contract.ts (modified, +1/-0)
  • src/tasks/task-registry.ts (modified, +5/-2)
RAW_BUFFERClick to expand / collapse

Goal

Expose background/detached work through SDK-facing task ledger RPCs.

The SDK has task nouns, and OpenClaw already has background activity concepts. External apps need a stable way to show subagents, ACP jobs, cron-like jobs, CLI tasks, and async work without reading internal session logs.

Proposed methods

  • tasks.list
  • tasks.get
  • tasks.cancel

Acceptance criteria

  • Tasks have stable IDs and statuses.
  • Tasks can be filtered by status, agent, and session.
  • Cancellation has a clear result contract.
  • Run/task/session relationships are visible when known.
  • @openclaw/sdk task namespace can stop throwing unsupported for these basics.

References

extent analysis

TL;DR

Implement the proposed tasks.list, tasks.get, and tasks.cancel RPCs to expose background work through the SDK-facing task ledger.

Guidance

Example

No code example is provided due to lack of implementation details in the issue.

Notes

The implementation details of the proposed RPCs are not specified, so the guidance is focused on understanding the requirements and acceptance criteria.

Recommendation

Apply workaround by implementing the proposed RPCs as described in the proposal document, as this will provide a stable way to expose background work through the SDK-facing task ledger.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Gateway RPC: add SDK-facing task ledger APIs [2 pull requests, 1 comments, 2 participants]