Skip to content

A cache publish on a store whose logs/ dir cannot be created bakes in 120/50 as though config had said so #358

Closed

Description

@fdaviddpt

Found by the release audit of v0.20.0..HEAD before tagging 0.21.0. Ranked misreports: non-blocking, filed rather than held.

The route

fd721fc (#352) added two keys to what _remember_env_cache_publish writes (scripts/lib-env-cache.sh:191-193):

printf 'REMEMBER_SAVE_COOLDOWN=%s\n' "${REMEMBER_SAVE_COOLDOWN:-120}"
printf 'REMEMBER_DELTA_THRESHOLD=%s\n' "${REMEMBER_DELTA_THRESHOLD:-50}"

Both are set by scripts/log.sh:382-410. But log.sh returns at line 61 — return 1 2>/dev/null || true — on a store whose logs/ directory cannot be created. That is before line 366 and far before 382, so neither variable is ever set.

Two publish sites source it with stderr suppressed and no guard:

  • scripts/user-prompt-hook.sh:86-87
  • scripts/post-tool-hook.sh:212-217 (slow path)

scripts/session-start-hook.sh:80-89 is the one site that does guard it (command -v _remember_date -> exit 127), and that guard was written for exactly this failure mode.

Why the validation cannot catch it

On a read-only or permission-denied store the cache records 120/50 as though config had said so. _remember_env_cache_load's new validation (scripts/lib-env-cache.sh:136-137) accepts them — they are digits, which is the one property that cannot distinguish a default from a configured value here. scripts/post-tool-hook.sh:510 and :542 then read them as authoritative for the life of the cache, which is invalidated only by a config mtime change. So a user with cooldowns.save_seconds set to something else gets the default silently, until they touch their config.

REMEMBER_TZ travels the same route and predates this delta, but an empty TZ is honestly empty. 120 is a claim.

What settles it

chmod 000 the store's logs/ dir, fire user-prompt-hook.sh, and read the published cache file against a config.json setting cooldowns.save_seconds to something other than 120.

Shape of a fix

The command -v _remember_date guard session-start already carries, before the publish call at both sites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority:high

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions