fix(crons): wire JSONL run logs + fix startedAt/sessionFile fields (#605)#901
Draft
vivekchand wants to merge 1 commit intomainfrom
Draft
fix(crons): wire JSONL run logs + fix startedAt/sessionFile fields (#605)#901vivekchand wants to merge 1 commit intomainfrom
vivekchand wants to merge 1 commit intomainfrom
Conversation
) The cron expand panel was stuck on "Loading run history…" because _cron_runs_from_transcripts() returned `timestamp` (epoch ms) and `sessionId`, but loadCronRuns() in app.js expects `startedAt` / `ts` (ISO-8601) and `sessionFile` ({sessionId}.jsonl). - Patch _cron_runs_from_transcripts() to emit all four field aliases so the 30-day calendar heatmap and run table can render them. - Add _cron_runs_from_jsonl(job_id): reads the dedicated JSONL run logs at ~/.openclaw/cron/runs/{jobId}.jsonl (path-traversal-safe, graceful on missing file), sorts newest-first, returns up to 50 records. - Update api_cron_runs() fallback chain: gateway RPC → JSONL file → transcript analytics. Closes #605 Co-Authored-By: ClawMetry Autofix Bot <bot-autofix@clawmetry.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The cron expand panel was stuck on "Loading run history…" forever because the backend returned
timestamp(epoch ms) andsessionId, butloadCronRuns()inapp.jsexpectsstartedAt/ts(ISO-8601 string) andsessionFile— so every run was silently dropped by the date renderer. Additionally, the rich per-run JSONL files at~/.openclaw/cron/runs/{jobId}.jsonlwere never consulted; the fallback was deriving synthetic records from session transcripts instead.Changes
dashboard.py— patch_cron_runs_from_transcripts()to emitstartedAt,ts, andsessionFilealongside the existingtimestamp/sessionIdso the 30-day calendar heatmap and run table render correctly.dashboard.py— add_cron_runs_from_jsonl(job_id): reads the dedicated on-disk run logs at~/.openclaw/cron/runs/{jobId}.jsonl(path-traversal-safe viaos.path.basename, graceful on missing file), sorts newest-first, returns up to 50 records with the realstatus,error,durationMs,costUsd, anddeliveryStatusfields from the agent.routes/crons.py— updateapi_cron_runs()fallback chain to three tiers: gateway RPC → JSONL file → transcript analytics.Test plan
python3 -c 'import ast; ast.parse(open("dashboard.py").read())'— no syntax errorspython3 -c 'import ast; ast.parse(open("routes/crons.py").read())'— no syntax errors~/.openclaw/cron/runs/{jobId}.jsonlfile, verify the panel shows actual run dataBot meta
Draft PR opened autonomously based on the plan in #605. Marked draft for human review — mark Ready for Review once happy.
Closes #605
Generated by Claude Code