Skip to content

bug(plugins): plugin tools intermittently unavailable in sub-agent sessions despite contracts.tools and compiled dist (regression from #56208) #80847

Description

@Jasen01

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Summary

Plugin-registered tools become unavailable in sub-agent sessions after 2-3 successful calls within the same gateway session. The tools work initially, then permanently fail with "plugin tool runtime missing" for the remainder of the session. Gateway restart temporarily restores functionality.

This appears to be a regression of #56208 (fixed by #56240 in 2026.3.x), reintroduced by the contracts.tools requirement and/or plugin registry validation changes in 2026.5.x. Related to #76603 (disabled plugins dropping all plugin tools) and #77826 (config writes dropping plugin tools).

Environment

  • OpenClaw: 2026.5.7 (eeef486)
  • Platform: Ubuntu 24.04, Node 22.22.2
  • Plugin: custom lossless-claw (LCM), registers 4 tools via context-factory api.registerTool((ctx) => ...)

Plugin setup (all requirements met)

  • openclaw.plugin.json has "contracts": { "tools": ["lcm_grep", "lcm_describe", "lcm_expand", "lcm_expand_query"] }
  • package.json has "main": "dist/index.js" and "openclaw": { "extensions": ["./dist/index.js"] }
  • TypeScript compiled to dist/ via tsc
  • Plugin loads cleanly at gateway start: [lcm] Plugin loaded with zero errors

Reproduction

  1. Start gateway — plugin loads, all tools available in main session
  2. Use lcm_grep in main session — works (always)
  3. Use lcm_describe in main session — works (always)
  4. Use lcm_expand_query (spawns sub-agent) — works for first 2-3 calls
  5. Wait ~5 minutes or trigger sub-agent archival
  6. Use lcm_expand_query again — fails with: plugin tool runtime missing (lossless-claw): lcm_expand_query
  7. All subsequent lcm_expand_query calls fail permanently within the session
  8. Gateway restart temporarily fixes it, cycle repeats

Log evidence

Steps to reproduce

Reproduction

  1. Start gateway — plugin loads, all tools available in main session
  2. Use lcm_grep in main session — works (always)
  3. Use lcm_describe in main session — works (always)
  4. Use lcm_expand_query (spawns sub-agent) — works for first 2-3 calls
  5. Wait ~5 minutes or trigger sub-agent archival
  6. Use lcm_expand_query again — fails with: plugin tool runtime missing (lossless-claw): lcm_expand_query
  7. All subsequent lcm_expand_query calls fail permanently within the session
  8. Gateway restart temporarily fixes it, cycle repeats

Expected behavior

Plugin tools declared in contracts.tools and successfully registered during register() should be available to all sub-agent sessions for the lifetime of the gateway process, regardless of sub-agent archival and respawn cycles.

Actual behavior

First call — works:
20:35:12 info agent — lcm_expand_query delegation: success (expansionDepth:1)
Later call — permanent failure:
20:51:33 error agent — lcm_expand_query failed: plugin tool runtime missing (lossless-claw): lcm_expand_query
20:51:45 error agent — lcm_expand_query failed: plugin tool runtime missing (lossless-claw): lcm_expand_query
20:52:01 error agent — lcm_expand_query failed: plugin tool runtime missing (lossless-claw): lcm_expand_query

OpenClaw version

2026.5.7

Operating system

Ubuntu 24.04, Node 22.22.2

Install method

nmp global

Model

claude opus 4.6

Provider / routing chain

openclaw

Additional provider/model setup details

Suggested fix

The #56240 fix (reuse active registry) needs to be extended to cover sub-agent respawn after archival. When a new sub-agent context is created and the parent gateway has an active plugin registry with the tool already registered, the sub-agent should inherit that registry rather than racing loadOpenClawPlugins() again. Alternatively, contracts.tools declarations should be treated as pre-registered tool stubs that satisfy the tool resolver even before register() runs — which was the alternative suggestion in #56208.

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

Labels

P2Normal backlog priority with limited blast radius.bugSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.regressionBehavior that previously worked and now fails

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions