openclaw - 💡(How to fix) Fix Feature: Per-session tool scoping for cron jobs [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#58966Fetched 2026-04-08 02:30:35
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Author
Timeline (top)
commented ×1

Code Example

{
  "payload": {
    "kind": "agentTurn",
    "message": "Check project progress...",
    "tools": ["message", "feishu_bitable_app_table_record", "sessions_send"],
    "model": "zai/glm-4.5-air"
  }
}
RAW_BUFFERClick to expand / collapse

Problem

Cron jobs running as isolated sessions inherit the agent's full tool configuration. For agents with many tools (e.g. 30+ Feishu tools), this means the system prompt + tool definitions can exceed 130K tokens, making it impossible to use smaller/cheaper models (e.g. glm-4.5-air with 131K context) for simple recurring tasks.

Real-world example: a project progress check cron task that only needs 3 tools (message, feishu_bitable_app_table_record, sessions_send) but inherits 30+ tool definitions, pushing total context to ~155K tokens and causing overflow on models with 131K context windows.

Proposed Solution

Allow cron job payload to specify a tool subset:

{
  "payload": {
    "kind": "agentTurn",
    "message": "Check project progress...",
    "tools": ["message", "feishu_bitable_app_table_record", "sessions_send"],
    "model": "zai/glm-4.5-air"
  }
}

When tools is specified, only those tool definitions are injected into the isolated session. When omitted, behavior is unchanged (all agent tools loaded).

Benefits

  1. Cost optimization: Use smaller/cheaper models for simple cron tasks
  2. Reduced latency: Smaller prompts = faster inference
  3. Better context utilization: More room for actual task content instead of unused tool schemas
  4. Security principle: Least privilege — cron tasks only get tools they need

Use Cases

  • Progress check tasks (3-5 tools) running every 30 min
  • Health check scripts (1-2 tools)
  • Daily reports (5-10 tools)
  • Any simple recurring task that doesn't need the full agent toolkit

extent analysis

TL;DR

Specify a subset of tools in the cron job payload to reduce the context size and allow the use of smaller models.

Guidance

  • To mitigate the issue, modify the cron job payload to include a "tools" field with the required tool subset, as shown in the proposed solution.
  • Verify that the total context size is within the model's limit by checking the token count after applying the tool subset.
  • Test the cron job with the modified payload to ensure it works as expected with the smaller model.
  • Consider reviewing and optimizing tool usage for other cron jobs to maximize the benefits of using smaller models.

Example

{
  "payload": {
    "kind": "agentTurn",
    "message": "Check project progress...",
    "tools": ["message", "feishu_bitable_app_table_record", "sessions_send"],
    "model": "zai/glm-4.5-air"
  }
}

Notes

This solution assumes that the "tools" field is supported by the system and that the model's context window is the only limiting factor.

Recommendation

Apply the workaround by specifying a tool subset in the cron job payload, as it allows for cost optimization, reduced latency, and better context utilization.

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