Skip to content

REMEMBER_EMIT_READ_MAX has no numeric guard, unlike every sibling knob in the same file #758

Closed

Description

@fdaviddpt

Filed while curating trap.d/695.emit-read-max-is-an-unvalidated-knob.md (declined as a
jit-context rule -- too narrow to be a standing agent lesson -- but the defect the fragment
names is still present at HEAD).

scripts/lib-memory-context.sh:198 reads ${REMEMBER_EMIT_READ_MAX:-16384} and uses it directly
in [ "$2" -gt "$_remember_emit_max" ], with no case (''|*[!0-9]*) guard -- while
MEMORY_INJECT_MAX_BYTES, log.sh's _budget/_grace, and every wc parse in the same file
all carry one.

Under set -eu with a non-numeric value, bash prints [: notanumber: integer expression expected to stderr, does not abort (the test is an if condition, so set -e is suppressed),
and falls through to the read arm -- sending every file down the quadratic path the 16 KB
threshold exists to keep them off. Low severity: this is an undocumented env knob nobody but a
developer would set to nonsense, not user-facing input.

Two honest fixes: guard it like its neighbours, or state in the comment that it is not
user-settable. Whichever a maintainer picks; not decided here.

[AI-generated]

Activity

  1. added
    priority:low
    filed-by-loop
    lane-other
    on Sep 25, 2026
  2. self-assigned this
    on Sep 25, 2026
  3. added a commit that references this issue on Sep 25, 2026
  4. removed their assignment
    on Sep 25, 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-otherpriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions