Skip to content

Guarded marker writes' stderr suppression fires after the write, not before -- "2>/dev/null" on "date +%s > MARKER || ..." leaves the shell's own permission-denied line unsuppressed #635

Closed

Description

@fdaviddpt

Found by the gate 3 release audit on the delta v0.29.1..HEAD (round 1), class B, row misreports. Non-blocking. Observed, not reasoned -- reproduced directly.

Both new guarded writes added by #625 are shaped like:

date +%s > "$COOLDOWN_MARKER" 2>/dev/null \
    || report_error "cooldown" "WARNING: could not write ..."

(scripts/save-session.sh:405 for COOLDOWN_MARKER, :999 for NDC_MARKER.) Redirections are processed left to right, so the > is attempted -- and fails -- before 2>/dev/null takes effect. The 2>/dev/null is nominally there to suppress the raw shell error but is effectively a no-op: it only redirects fd 2 for whatever the shell does after the failed redirection is already reported.

Reproduced against a chmod 500 directory:

--- stderr.txt contents ---
t.sh: line 3: blocked/marker: Permission denied
--- fired.log ---
REPORT_ERROR_FIRED: WARNING: could not write blocked/marker

Both the shell's raw message and the intended report_error line are emitted -- a guard with no positive control, since nothing was actually being suppressed.

Mitigation confirmed, not assumed: scripts/bootstrap-dirs.sh:336 does exec 2>> "$REMEMBER_DIR/logs/hook-errors.log", and save-session.sh sources it at :77, so the stray line lands in hook-errors.log (already flattened per #618) rather than leaking into the agent's own stream -- except on the path where logs/ itself could not be created. So the consequence is a duplicated, unflattened line in the file a bug reporter is asked to paste, not a stream leak, but the redirection reads as if it suppresses the raw message and it does not.

Fix: move the redirection ahead of the write, e.g. { date +%s > "$MARKER"; } 2>/dev/null || ..., or drop the now-misleading 2>/dev/null entirely since hook-errors.log already catches it.

[AI-generated, filed by the maintainer loop's gate 3 release audit]

[AI-generated]

Activity

  1. added
    priority:low
    filed-by-loop
    lane-capture
    cohort-9
    on Sep 10, 2026
  2. self-assigned this
    on Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cohort-9filed-by-looplane-capturepriority:low

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions