Skip to content

fix(watchdog): checkpoint-operator-diagnostics - #33

Merged
stephenctw merged 4 commits into
mainfrom
fix/watchdog-missing-head
Aug 18, 2026
Merged

fix(watchdog): checkpoint-operator-diagnostics#33
stephenctw merged 4 commits into
mainfrom
fix/watchdog-missing-head

Conversation

@stephenctw

Copy link
Copy Markdown
Collaborator

Summary

  • Treat missing/corrupt watchdog head.json as a non-retryable operator/state error so tick exits once instead of burning the default 3×5s retry budget.
  • Enrich the failure log with state_dir, expected layout, init && tick, wipe/re-init, and persistent-volume troubleshooting so operators can repair from stderr alone.
  • Ensure status.prom is rewritten promptly to state="warning" on this path.

Context

Production ticks were failing with failed to load watchdog head: missing head.json after loading config.json. That means incomplete state (no checkpoint pointer). tick never bootstraps a head from env; retrying cannot create one. Retries delayed exit and could leave metrics stale if the process was killed mid-retry.

Test plan

  • lua watchdog/tests/run.lua (includes new cases: no retry on missing head; tick writes status.prom warning once; enriched error assertions)

@stephenctw stephenctw self-assigned this Aug 12, 2026
@stephenctw stephenctw changed the title Fix/watchdog missing head fix(watchdog): fail fast on missing head.json Aug 12, 2026
@stephenctw stephenctw changed the title fix(watchdog): fail fast on missing head.json fix(watchdog): checkpoint-operator-diagnostics Aug 13, 2026
@stephenctw

Copy link
Copy Markdown
Collaborator Author

86b99f3 — diagnose watchdog dirs as recovery dumps
If setup --recovery is pointed at a watchdog checkpoint (has manifest.json / snapshot/), say so instead of a bare ENOENT on info.toml, and point operators at a sequencer dumps// directory.

endersonmaia
endersonmaia previously approved these changes Aug 13, 2026

@endersonmaia endersonmaia 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.

Minor comment about the logs. Not blocking, feel free to tackle this on following versions.

I tested the recovery process and the logs are much more detailed helping me to look at the right place.


While at it, I found that some directories had different casing, but unfortunately I coulnd't reproduce it.

Those are the same address:

  • 0x8cD07E9089bbB734f667F5AdaD318299c0A90437
  • 0x8cd07e9089bbb734f667f5adad318299c0a90437

I think we could agree to normalize to lowercase everywhere, this could be done at another PR.

Comment thread watchdog/runner.lua Outdated
Comment on lines +32 to +39
" 1. ls "
.. state_dir
.. " — expect config.json, head.json, and checkpoints/<safe_block>/",
" 2. if head.json is missing: run `sequencer-watchdog init` with CARTESI_WATCHDOG_CM_SNAPSHOT_DIR and CARTESI_WATCHDOG_CM_SNAPSHOT_SAFE_BLOCK set to a CM snapshot whose safe block equals the sequencer's current finalized inclusion_block, then run `tick`",
" 3. schedule `sequencer-watchdog init && sequencer-watchdog tick` (init is a no-op when state is already complete)",
" 4. if head.json exists but config.json or the selected snapshot is missing/corrupt: wipe state_dir and re-init",
" 5. ensure CARTESI_WATCHDOG_STATE_DIR is a persistent volume (empty/ephemeral dirs lose head.json across restarts)",
}, "\n"))

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.

I'd avoid multiline error logs and this kind of detailed step by step should be on the docs

so I think we shoud give a detailed error with paths and stuff, like walredy done before and point to a documentation with this step by step, also like you did before like See docs/snapshots/lifecycle.md and docs/recovery/cockroach.md.

@stephenctw

Copy link
Copy Markdown
Collaborator Author

@endersonmaia I've made all changes you requested, please take a look!

@stephenctw
stephenctw force-pushed the fix/watchdog-missing-head branch from 04ef167 to 757882d Compare August 18, 2026 11:17
Do not burn the tick retry budget on an operator/state error that
cannot self-heal; surface an init hint and write status.prom promptly.
Include state_dir, expected layout, init&&tick, wipe, and volume hints
so operators can repair from stderr alone.
Pointing setup --recovery at a watchdog CM checkpoint produced a bare
ENOENT on info.toml. Detect that layout and tell operators to use a
sequencer dumps/<id>/ directory instead.
Keep the load-failure error short (paths + init hint) and move the
step-by-step repair into operator-deployment.md. Normalize app and
input-box addresses to lowercase so EIP-55 vs lower forms do not
diverge in config.json or status.prom labels.
@stephenctw
stephenctw force-pushed the fix/watchdog-missing-head branch from 757882d to 174b7bc Compare August 18, 2026 11:36
@stephenctw
stephenctw merged commit f59ec25 into main Aug 18, 2026
8 checks passed
@stephenctw
stephenctw deleted the fix/watchdog-missing-head branch August 18, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants