Skip to content

A single failed run permanently corrupts the collector state, and it can never self-heal #1

Description

@BudaiSamuel-dev

Bug: a single failed run permanently corrupts the collector state, and it can never self-heal

bin/gitwork reads its own previous output (the -output path, e.g.
~/.local/state/omarchy/git/overview.json) on every run and passes its
content to jq as --argjson previous "$previous" so it can carry forward
stale-host data.

If that file ever ends up containing invalid JSON (e.g. from a run that
was interrupted mid-write, or a bug in the merge step itself under some
edge case), every subsequent run fails immediately with:

jq: invalid JSON text passed to --argjson
gitwork: could not assemble the overview

Because the failure happens while reading the previous state, the script
exits before it can write a fresh, valid file. The broken file is never
replaced — the collector is stuck permanently, silently failing every
refreshIntervalSec forever, with no self-recovery path.

Reproduction

# Seed a "previous" file with one extra trailing brace, simulating a corrupt write
cat > /tmp/overview.json << 'JSON'
{
  "schemaVersion": 3,
  "updatedAt": "2026-01-01T00:00:00Z",
  "providers": []}}
JSON

bin/gitwork -output /tmp/overview.json
# -> jq: invalid JSON text passed to --argjson
# -> gitwork: could not assemble the overview
# /tmp/overview.json is left untouched (still invalid) — every future run fails the same way

Expected behavior

A malformed previous-state file should be treated the same way a missing
one is (e.g. fall back to previous={} with a warning), rather than
aborting the whole collection run. That would let the collector recover on
its own the next cycle instead of requiring the user to manually delete
overview.json to unstick it.

Environment

  • Plugin version: 2.1.0
  • Symptom: bar widget shows stale/no data indefinitely; journalctl --user
    shows dev.git jq: invalid JSON text passed to --argjson /
    gitwork: could not assemble the overview repeating every refresh interval

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions