Skip to content

agy hook scripts render a malformed payload identically to an empty one, then exit 0 having captured nothing #568

Closed

Description

@fdaviddpt

Found by the release audit of v0.27.0..HEAD (round 1, dispatch token e1a766657500), while gating the 0.28.0 tag. Ranked misreports — can ship behind a filed issue, so it did not block. Class A: an absence the caller cannot read.

scripts/agy-stop-hook.sh:84-92, scripts/agy-session-start-hook.sh:71 and scripts/agy-pre-invocation-hook.sh:56 each normalise the hook's stdin with python3 ... 2>/dev/null) || _FIELDS="", wrapping an inner except Exception: d = {}.

So a malformed payload, or a machine with no python3 at all, produces exactly the output an empty-but-valid payload produces. The stop hook then takes its exit 0 arm having captured nothing, and nothing anywhere says so.

Exercised in isolation (the hook scripts themselves were not run — they call save-session.sh, which writes):

A) malformed payload:  <EMPTY> <EMPTY>
B) empty object:       <EMPTY> <EMPTY>
C) valid payload:      abc  /t.jsonl

C fires, so A and B collapsing is a measurement rather than a dead harness.

This is the same shape #478 and #556 exist to un-collapse, reintroduced at the new host boundary. The port's own comments record the cost: scripts/agy-stop-hook.sh:98-101 notes losing a FATAL to a /dev/null redirect during development.

Settling fact, already established: a log line on the failure arm is safe here. agy parses these hooks' stdout as protojson, but the scripts already redirect stdout, so stderr and the existing log helper are both free to use.

A fix needs a test that distinguishes the three cases above, with C as the positive control.

[AI-generated]

Activity

  1. added
    priority:medium
    filed-by-loop
    on Sep 5, 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-looppriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions