Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@spiceoogway
Copy link
Contributor

Problem

clawdbot cron list crashes when a cron job uses id instead of jobId.

Fix

Added defensive property access to handle both jobId and id fields.

Testing

  • Build passes
  • Linter clean

Fixes #4373

…ixes openclaw#4367)

The message processing pipeline had a synchronization bug where
limitHistoryTurns() truncated conversation history AFTER
repairToolUseResultPairing() had already fixed tool_use/tool_result
pairings. This could split assistant messages (with tool_use) from
their corresponding tool_result blocks, creating orphaned tool_result
blocks that the Anthropic API rejects.

This fix calls sanitizeToolUseResultPairing() AFTER limitHistoryTurns()
to repair any pairings broken by truncation, ensuring the transcript
remains valid before being sent to the LLM API.

Changes:
- Added import for sanitizeToolUseResultPairing from session-transcript-repair.js
- Call sanitizeToolUseResultPairing() on the limited message array
- Updated variable name from 'limited' to 'repaired' for clarity
- Enhanced SubagentRunOutcome type with errorType and errorHint fields
- Added categorizeError() helper to classify common error patterns:
  * File system errors (ENOENT, EACCES, etc.)
  * API/model errors (rate limits, auth failures, invalid requests)
  * Network errors (connection refused, DNS failures)
  * Timeout errors
  * Configuration errors (missing credentials, quota limits)
- Updated error emission in agent-runner-execution.ts to categorize errors
- Updated subagent-registry.ts to capture and propagate new error fields
- Added buildErrorStatusLabel() helper for user-friendly error messages
- Error announcements now include error type and remediation hints

Example improved messages:
- Before: 'failed: unknown error'
- After: 'failed (tool error): ENOENT — File or directory not found'

This makes subagent failures much easier to understand and debug while
maintaining backward compatibility.
Fixes openclaw#4373

The printCronList function was crashing when accessing job.id because
the Gateway API may return jobId instead of id depending on the version
or context. This adds a defensive check that tries jobId first, then
falls back to id, then to empty string.

Changes:
- src/cli/cron-cli/shared.ts: Extract id with type assertion to handle
  both jobId and id properties, preventing TypeError on .padEnd()
@moltbot-barnacle moltbot-barnacle bot added cli CLI command changes agents Agent runtime and tooling labels Jan 30, 2026
@spiceoogway
Copy link
Contributor Author

CI failures are all pre-existing on main — none caused by this PR:

  • install-smoke — Docker smoke test infra issue
  • formatsrc/commands/onboard-helpers.ts formatting (exists on main)
  • testsrc/config/paths.test.ts:52 expects length 1 but gets 16 (exists on main)

Tests cover:
- Standard id property
- jobId fallback (Gateway API variant)
- jobId preferred over id when both present
- No crash when both id and jobId are missing
- Empty job list and multiple jobs
- parseDurationMs unit tests
@moltbot-barnacle moltbot-barnacle bot added the commands Command implementations label Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: cron list crashes with TypeError on job.id (should be job.jobId)

1 participant