Skip to content

_jq_fallback drops --arg, so jq-less installs report every previous session as unsaved and spawn save-session.sh --force on every start #667

Closed

Description

@fdaviddpt

Found while mapping #660's spawn budget; this one is correctness, not only latency. Related to #660 because it hits exactly the Windows/Git Bash installs that ship without jq.

Observed

detect-tools.sh:90 _jq_fallback (the Python stand-in used when jq is absent) strips --arg and its value from the argument list. session-start-hook.sh:333 calls jq -r --arg id "$SESSION_ID" … last-save.json through session_was_saved. Without the --arg, the filter never matches, so session_was_saved answers "unsaved" for every previous session.

Consequence at :708: save-session.sh --force (and its Python pipeline) is spawned detached on every session start on a jq-less install. It is backgrounded, so it does not block the hook, but it competes for CPU during the exact window #660 measures, and it re-saves sessions that were already saved.

Git for Windows does not bundle jq, so a Windows user who never installed it is on this path by default.

Fix shape

Teach _jq_fallback to accept --arg name value (and --argjson) and bind them as variables in the Python filter shim; or give session_was_saved a jq-free path that reads last-save.json with a single Python call carrying the id as an argument.

Positive control: with jq masked off PATH, a saved previous session is reported saved and no save-session.sh --force spawn occurs; negative: an unsaved one still triggers recovery. The existing recovery tests (tests/test_recovery_*) supply the harness.

[AI-generated]

Activity

  1. added
    priority:high
    filed-by-loop
    lane-capture
    on Sep 11, 2026
  2. self-assigned this
    on Sep 12, 2026
  3. removed their assignment
    on Sep 12, 2026
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

    filed-by-looplane-capturepriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions