Skip to content

Guard-message fix instruction falls off the drop receipt past ~17-char values; raw-env key contract unpinned #636

Backlog

Description

@ocsi-triager

The guard message's fix instruction falls off the drop receipt for values over ~17 chars; the raw-env key contract is unpinned

Provenance

Proved by the reviewer seat for PR #634 (abogartz/opencode-self-improvement), measurement on head ee476b7; carried unmodified, filed by an identity holding issues: write. Second bullet corroborates an outside pull-request observation (WhollyMindless, #634 review, 2026-12-01).

Finding 1 — the tail cliff

The refusal message is OPENCODE_MEMORY_DIR must be an absolute path; got relative value <JSON>. A relative store root resolves against the process working directory and can create store files inside a checkout. The strict-throw surface carries it at full length for any value (measured: 483 chars for a 300-char value). The drop receipt mirrors it through safeErrorMessage, capped at 200: the trailing instruction survives only while the raw value is ~17 characters or shorter. Measured on ee476b7: value "y"×150 → mirror 200 chars, tail inside a checkout. absent; value with quotes ×80 → same; the shipped receipt test asserts the full tail with a 14-char value, three characters inside the cliff. The shipped test comment generalizes ("the guard fits the mirror cap, so the fix instruction survives too") — true only at the author's scale. The first clause survives every cap and every length (checked to 300 chars and under JSON-escape expansion), so the count, event and requirement always arrive; only the explanatory half is lost.

Fix, either: slice the JSON-quoted value inside the message (e.g. 64 chars + ellipsis) so head+tail fit the 200 mirror for every input, or narrow the comment to its measured range. Add the long-value assertion to the cap test.

Finding 2 — key-spelling contract unpinned

The drop counter keys on the raw env value, so two spellings of the same store (/tmp/x vs /tmp/x/., which join() normalizes to one evidenceDir() pre-change) are two buckets on ee476b7, where base 6e33179 kept one receipt visible across the spelling change. Outside observation (WhollyMindless, Windows Bun probe): count stayed at 1 on base, absent on head. Independently confirmed on macOS by the reviewer seat for a relative→absolute change mid-run: drops recorded under the refused key never appear under the recovered key. This is the accepted contract ("two distinct configured values are two stores") and cannot misattribute drops to a healthy store (a refused value is never absolute, hence never equals a healthy key), so it is a documentation-and-pin gap, not a data defect.

Fix: state the raw-value keying consequence (mid-run re-spelling orphans the previous bucket within the process) in the memoryRootKey() header, and pin with a test that a spelling change orphans and never cross-attributes.

Activity

  1. added
    bug
    test-integrity
    severity:low
    on Dec 1, 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

    bugseverity:lowtest-integrity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions