Skip to content

fix(cron): include job name when reading single-job run history - #88294

Merged
steipete merged 5 commits into
openclaw:mainfrom
kip-claw:fix/cron-history-job-name
Jun 1, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
kip-claw:fix/cron-history-job-name

Conversation

@kip-claw

@kip-claw kip-claw commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

In Control UI Cron run history, the single-job view could render the raw job id instead of the human-readable job name. The UI title uses entry.jobName ?? entry.jobId, so missing jobName in the gateway response becomes visible immediately.

The all-jobs cron.runs path already builds a jobNameById map and passes it through run-log enrichment. The single-job path did not pass any job-name lookup, so entries returned for one job could still lack jobName.

Fix

  • In the single-job cron.runs gateway branch, resolve the current job with context.cron.list({ includeDisabled: true }).
  • Pass a one-entry jobNameById map into the existing SQLite run-log reader enrichment path.
  • Leave deleted/missing jobs unchanged: if the job no longer exists, the map is undefined and the UI keeps the existing id fallback.
  • Add regression coverage at both levels:
    • gateway cron behavior asserts single-job cron.runs returns jobName;
    • run-log reader asserts jobNameById stamps single-job page entries.

No schema migration, dependency change, or new runtime storage path.

Real behavior proof

Behavior addressed: Single-job cron.runs responses lacked jobName, so Control UI run-history titles fell back to the raw job id.

Real environment tested: Raspberry Pi 4 Model B, ARM64 Debian bookworm, OpenClaw 2026.5.27 (27ae826), Node 22.x, patched installed gateway dist under /usr/lib/node_modules/openclaw/dist/.

Exact steps or command run after this patch: Restarted openclaw.service after applying the equivalent gateway patch, cleared /var/tmp/openclaw-compile-cache, then ran:

openclaw cron runs --id 9e89b060-00ac-4e2d-8cc0-a9848f4a3e27 --limit 1 | grep -i 'jobname'

Evidence after fix: Terminal output from the real patched Pi setup:

      "jobName": "Twitter archive export"

Observed result after fix: The gateway response now carries the live job name for the single-job run-history entry. That is the field consumed by the Control UI render path entry.jobName ?? entry.jobId, so the run-history title shows Twitter archive export instead of the raw UUID.

What was not tested: Windows/macOS runtime, deleted jobs whose historical rows no longer have a current job definition, and a Control UI screenshot through the tailnet-only nginx setup.

Maintainer verification

pnpm test src/cron/run-log.test.ts src/gateway/server.cron.test.ts src/agents/tools/cron-tool.schema.test.ts -- --reporter=verbose

Result: 3 Vitest shards passed, 49 tests passed.

pnpm format:check -- src/cron/run-log.test.ts src/gateway/server-methods/cron.ts src/gateway/server.cron.test.ts

Result: all matched files use the correct format.

.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main

Result: clean, no accepted/actionable findings.

env PATH=<temporary corepack-pnpm shim> OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 CI=1 PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm check:changed

Result: passed locally. Direct pnpm check:changed first attempted delegated Testbox and failed because blacksmith is not installed locally; direct Azure Crabbox fallback queued for 10 minutes and timed out before leasing (run_1fee25ccd7fc, cbx_05ca4f92c90d).

AI Disclosure

  • AI-assisted (GitHub Copilot / Codex maintainer rewrite)
  • Human-run real behavior proof from own setup (Pi, patched dist)
  • Maintainer tests/review run against current main
  • Understand what the code does
  • Allow edits by maintainers enabled

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. size: XS labels May 30, 2026
@clawsweeper

clawsweeper Bot commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 1, 2026, 12:07 AM ET / 04:07 UTC.

Summary
The branch enriches single-job cron.runs responses with the current job name and updates cron/run-log tests plus nullable cron-tool schema and Codex prompt snapshots.

PR surface: Source +1, Tests +311. Total +312 across 12 files.

Reproducibility: yes. from source inspection: current main's single-job cron.runs path omits jobNameById, and the UI falls back to jobId when jobName is absent. I did not execute a current-main repro because this review was read-only.

Review metrics: 1 noteworthy metric.

  • Cron tool schema surface: 2 nullable helper constructors changed. The raw cron tool schema now exposes explicit null unions, so the paired provider-projection tests and prompt snapshot refresh are material to merge confidence.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Next step before merge

  • [P2] No repair lane is needed because the open PR already contains the focused patch, regression tests, and real behavior proof; remaining work is maintainer merge review and normal gates.

Security
Cleared: The diff does not touch dependencies, lockfiles, workflows, scripts, secrets, permissions, or package execution paths, and I found no concrete security or supply-chain concern.

Review details

Best possible solution:

Land this branch or an equivalent fix that passes a job-name lookup into single-job cron.runs while preserving provider-compatible nullable tool schema projection and regression coverage.

Do we have a high-confidence way to reproduce the issue?

Yes from source inspection: current main's single-job cron.runs path omits jobNameById, and the UI falls back to jobId when jobName is absent. I did not execute a current-main repro because this review was read-only.

Is this the best way to solve the issue?

Yes, this is a maintainable fix: it reuses the existing run-log enrichment contract and keeps the deleted-job fallback unchanged. A direct readJob lookup would be slightly narrower than listing jobs, but the submitted shape mirrors the all-jobs path and is not a blocking defect.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 3b802a7fbc5a.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal proof from a real Raspberry Pi gateway install showing openclaw cron runs --id ... returning the expected jobName.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This fixes a user-visible cron run-history title bug with limited gateway/UI blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-fix terminal proof from a real Raspberry Pi gateway install showing openclaw cron runs --id ... returning the expected jobName.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal proof from a real Raspberry Pi gateway install showing openclaw cron runs --id ... returning the expected jobName.
Evidence reviewed

PR surface:

Source +1, Tests +311. Total +312 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 2 9 8 +1
Tests 10 415 104 +311
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 424 112 +312

What I checked:

  • Current-main bug surface: On current main, the all-jobs cron.runs branch builds jobNameById, but the single-job branch calls readCronRunLogEntriesPage without that lookup. (src/gateway/server-methods/cron.ts:619, 3b802a7fbc5a)
  • Visible UI fallback: The Control UI renders run titles as entry.jobName ?? entry.jobId, so a missing jobName from the gateway response makes the raw id visible. (ui/src/ui/views/cron.ts:1850, 3b802a7fbc5a)
  • PR implementation: The PR head looks up the matching current job and passes a one-entry jobNameById map into the single-job run-log read. (src/gateway/server-methods/cron.ts:635, 6687cf8d8642)
  • Existing enrichment callee: readCronRunLogEntriesPage already stamps entries from jobNameById in both non-query and query paths, so the PR reuses the existing owner boundary instead of adding UI-only logic. (src/cron/run-log.ts:331, 3b802a7fbc5a)
  • Codex dynamic-tool contract checked: Sibling Codex source stores dynamic-tool input_schema as JSON and its tool schema parser preserves explicit anyOf and null schema types, matching the refreshed prompt snapshots.
  • History and ownership: Blame ties the current cron.runs and run-log enrichment implementation to commit 91ca036; recent adjacent cron schema work also appears in f42cf90. (src/gateway/server-methods/cron.ts:602, 91ca03671731)

Likely related people:

  • @vincentkoc: Current blame points the cron.runs handler, run-log enrichment, and cron tool schema surface to commit 91ca036. (role: introduced/current behavior; confidence: high; commits: 91ca03671731, f42cf9059e7e; files: src/gateway/server-methods/cron.ts, src/cron/run-log.ts, src/agents/tools/cron-tool.ts)
  • @steipete: Recent adjacent cron run-log comments and cron nullable-schema repair commits touch the same review surface, and the PR timeline shows maintainer force-pushes from this account. (role: recent adjacent contributor; confidence: medium; commits: 1e7510ae103e, ee6373aa5fec, 6687cf8d8642; files: src/cron/run-log.ts, src/agents/tools/cron-tool.ts, test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels May 30, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 30, 2026
@kip-claw

Copy link
Copy Markdown
Contributor Author

Added a focused regression test in 52ada5f901 (pushed as a follow-up commit, not a force-push over the original fix).

File: src/cron/run-log.test.ts
Test: cron run log > stamps current jobName onto historical entries (single-job scope)

The test writes two historical JSONL entries (no jobName on disk, simulating older writer output) and asserts:

  1. Without opts.jobName — readCronRunLogEntriesPage(...) returns both entries with jobName === undefined. This is the current-day bug surface: the Control UI's entry.jobName ?? entry.jobId render path then falls back to the raw UUID in the run-history pulldown header.
  2. With opts.jobName: \"Current Name\" (matching what cron.runs's single-job branch now passes after looking up the job via context.cron.list({ includeDisabled: true })) — every entry comes back stamped with \"Current Name\", mirroring the enrichment the all-jobs scope already does via jobNameById.

Real test run (Crabbox / Cloudflare standard-4)

```
RUN v4.1.7 /workspace/crabbox
✓ cron ../../src/cron/run-log.test.ts (16 tests) 188ms

Test Files 1 passed (1)
Tests 16 passed (16)
Duration 1.43s

cloudflare run summary sync=41.684s command=2m50.812s total=3m32.517s exit=0
```

15 pre-existing tests + 1 new regression test, all green. To run locally:

```bash
pnpm exec vitest run src/cron/run-log.test.ts
```

Note on "non-clobber" behavior

An earlier draft of the test also asserted that a pre-existing jobName on disk would be preserved (not overwritten by opts.jobName). I removed that assertion because parseAllRunLogEntries reconstructs each entry from a fixed allow-list of fields and does not currently carry over any on-disk jobName — so in practice every entry reaches the enrichment step with jobName === undefined. The non-clobber guard in the implementation (if (!existing)) is still correct and defensive against future writer changes that may persist jobName, but isn't exercisable by a test against the current parser without first widening the parser, which is out of scope for this PR.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels May 30, 2026
@steipete steipete self-assigned this Jun 1, 2026

@steipete steipete left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer review after current main update: the fix idea is still the right one, but this branch is now stale and cannot merge.

Blocking before merge: GitHub reports mergeable=CONFLICTING / mergeStateStatus=DIRTY, and a local git merge-tree against current origin/main conflicts in src/cron/run-log.ts, src/cron/run-log.test.ts, and src/gateway/server-methods/cron.ts. main has since moved cron run history to the SQLite/object-argument API: readCronRunLogEntriesPage now takes one options object with storePath at src/cron/run-log.ts:284, while this PR still patches the older readCronRunLogEntriesPage(logPath, opts) shape.

The bug still exists on current main: the all-jobs branch builds jobNameById and passes it to the reader at src/gateway/server-methods/cron.ts:576, but the single-job branch at src/gateway/server-methods/cron.ts:591 still calls readCronRunLogEntriesPage with only storePath, jobId, and filters. The UI still renders ${entry.jobName ?? entry.jobId} at ui/src/ui/views/cron.ts:1850, so historical entries without jobName still fall back to the raw id.

Best fix: rebase/adapt this same approach onto current main by adding single-job name enrichment to the current object-based reader path, or by passing a one-entry jobNameById map from the single-job gateway branch. The regression test also needs to use the current SQLite/migration helper shape rather than writing directly to the old JSONL reader signature.

Code read: src/cron/run-log.ts, src/cron/run-log/entry-codec.ts, src/cron/run-log/sqlite-store.ts, src/gateway/server-methods/cron.ts, src/cron/run-log.test.ts, ui/src/ui/views/cron.ts. No duplicate/related gitcrawl hits found for this exact cron run-history jobName symptom.

@steipete
steipete force-pushed the fix/cron-history-job-name branch from 52ada5f to e045e36 Compare June 1, 2026 02:04
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: supplied External PR includes structured after-fix real behavior proof. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 1, 2026
@steipete
steipete force-pushed the fix/cron-history-job-name branch from e045e36 to 2cdddfb Compare June 1, 2026 02:10
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Jun 1, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jun 1, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 1, 2026
@steipete
steipete force-pushed the fix/cron-history-job-name branch from 5951b6f to 9ee3f6a Compare June 1, 2026 03:34
@steipete
steipete force-pushed the fix/cron-history-job-name branch from ecf9b7c to 6687cf8 Compare June 1, 2026 04:00
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 1, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jun 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added the channel: matrix Channel integration: matrix label Jun 1, 2026
Kip Claw and others added 5 commits June 1, 2026 00:19
The cron.runs gateway handler enriches log entries with jobName in the all-jobs scope, but the single-job scope did not pass any job-name lookup into the SQLite run-log reader. Entries returned for one job could therefore reach Control UI without jobName, making the run-history title fall back to the raw job id.

Build a one-entry jobNameById map for the current job and pass it through the same reader enrichment path used by all-jobs history. If the job no longer exists, the map stays undefined and existing fallback behavior is unchanged.
Asserts that readCronRunLogEntriesPage stamps a supplied jobNameById map onto single-job page entries, matching the gateway data shape used for both all-jobs and single-job cron.runs responses.

Addresses review feedback on openclaw#88294.
@steipete
steipete force-pushed the fix/cron-history-job-name branch from e25fd82 to 456965f Compare June 1, 2026 04:21
@openclaw-barnacle openclaw-barnacle Bot removed the channel: matrix Channel integration: matrix label Jun 1, 2026
@steipete

steipete commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Maintainer update: rebased and rewrote this onto the current cron run-log architecture.

What changed:

  • Single-job cron.runs now enriches returned run-log entries with the current job name via the existing jobNameById reader path, matching the all-jobs history behavior.
  • Added SQLite-era regression coverage for direct run-log paging and gateway cron.runs single-job responses.
  • Kept cron tool runtime schema nullable for clear/unset semantics while asserting provider-facing schema projection stays OpenAPI-compatible.
  • Refreshed prompt snapshots for the schema byte change.

Local proof on final branch:

  • pnpm test src/cron/run-log.test.ts src/gateway/server.cron.test.ts src/agents/tools/cron-tool.schema.test.ts src/agents/tools/cron-tool.test.ts -- --reporter=verbose
  • pnpm prompt:snapshots:check
  • pnpm format:check -- src/agents/tools/cron-tool.ts src/agents/tools/cron-tool.schema.test.ts src/agents/tools/cron-tool.test.ts src/cron/run-log.test.ts src/gateway/server-methods/cron.ts src/gateway/server.cron.test.ts test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/codex-dynamic-tools.telegram-direct.json test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/telegram-direct-codex-message-tool.md
  • OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 CI=1 PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm check:changed
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main clean, no accepted/actionable findings.

CI proof:

  • Final head 456965ff41441e9c562aae86e5955b5f80d67ff4
  • CI run 26734991840 green; PR is CLEAN/MERGEABLE.

Known proof gap: no live Pi/Telegram rerun from me; the PR retains the contributor's supplied real-device proof for the user-visible CLI symptom.

@steipete
steipete merged commit c213827 into openclaw:main Jun 1, 2026
159 of 161 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 1, 2026
…claw#88294)

* fix(cron): include job name in single-job run history

The cron.runs gateway handler enriches log entries with jobName in the all-jobs scope, but the single-job scope did not pass any job-name lookup into the SQLite run-log reader. Entries returned for one job could therefore reach Control UI without jobName, making the run-history title fall back to the raw job id.

Build a one-entry jobNameById map for the current job and pass it through the same reader enrichment path used by all-jobs history. If the job no longer exists, the map stays undefined and existing fallback behavior is unchanged.

* test(cron): cover single-job run history job name enrichment

Asserts that readCronRunLogEntriesPage stamps a supplied jobNameById map onto single-job page entries, matching the gateway data shape used for both all-jobs and single-job cron.runs responses.

Addresses review feedback on openclaw#88294.

* test(cron): preserve nullable tool schema validation

* test(cron): assert runtime nullable tool schema

* test(cron): refresh prompt snapshots

---------

Co-authored-by: Kip Claw <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
…claw#88294)

* fix(cron): include job name in single-job run history

The cron.runs gateway handler enriches log entries with jobName in the all-jobs scope, but the single-job scope did not pass any job-name lookup into the SQLite run-log reader. Entries returned for one job could therefore reach Control UI without jobName, making the run-history title fall back to the raw job id.

Build a one-entry jobNameById map for the current job and pass it through the same reader enrichment path used by all-jobs history. If the job no longer exists, the map stays undefined and existing fallback behavior is unchanged.

* test(cron): cover single-job run history job name enrichment

Asserts that readCronRunLogEntriesPage stamps a supplied jobNameById map onto single-job page entries, matching the gateway data shape used for both all-jobs and single-job cron.runs responses.

Addresses review feedback on openclaw#88294.

* test(cron): preserve nullable tool schema validation

* test(cron): assert runtime nullable tool schema

* test(cron): refresh prompt snapshots

---------

Co-authored-by: Kip Claw <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants