Skip to content

feat(badge/status/installer): fix badge, add status inventory, agy trust - #50

Merged
s-annam merged 1 commit into
mainfrom
save-badge-status-agy-batch
Jul 24, 2026
Merged

feat(badge/status/installer): fix badge, add status inventory, agy trust#50
s-annam merged 1 commit into
mainfrom
save-badge-status-agy-batch

Conversation

@s-annam

@s-annam s-annam commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

Three related okfmem changes landed together on one umbrella branch as a single
commit:

Resolves #49
Resolves #43
Resolves #42

Also note: #44 (structural save-state parser) was already shipped by #45/#47 and
is not part of this diff — it can be closed separately.

Test plan

  • python3 scripts/check-leaks.py exits 0 (64 files, no leaks)
  • python3 -m pytest -q → 246 passed, 1 skipped
  • bash -n install.sh uninstall.sh OK; .ps1 files pure ASCII
  • Windows CI matrix (verify) green
  • Smoke: okfmem status / okfmem status --all render the new section

Adversarial review

An independent reviewer attacked the accumulated diff before this PR was opened.

Round 1 — 1 blocking finding (fixed): is_scratch_path's blanket
scratchpad-path-segment fallback matched any path containing a directory
named scratchpad at any depth — so a committed docs/scratchpad/adr.md edit
would classify as non-work, clear the badge, and silently lose a genuinely
uncaptured session
(the exact failure the badge exists to prevent). Fixed by
dropping the blanket fallback: is_scratch_path now returns True only for
paths under _ephemeral_roots() (OS temp roots + $CLAUDE_SCRATCHPAD_DIR). The
real harness scratchpad already lives under /private/tmp, so it's still caught;
a project-internal scratchpad/ is not. Regression tests added; the strictly
narrower rule can only ever err toward a benign unsaved nag, never a false
saved.

Nits (not blocking): corrupt hand-edited trustedFolders.json is replaced
rather than merged on grant (mitigated — a .okfmem.bak backup is written
first); /okfmem no longer reports the engine clone's own git status (arguable
intentional scope-narrowing to store-backup health).

Reviewer verdict after the fix: #43 status-inventory and #42 agy-grant consent
gating were both found solid — consent complete on every rung-2 write path,
probes read-only and dispatched before the store-shape check, revoke touches
only okfmem's own entry, no argparse-flag collisions.

Provenance

Stage Model Effort
Implementation — #49 Claude Opus 4.8 high (--quality)
Implementation — #43 Claude Opus 4.8 high (--quality)
Implementation — #42 Claude Opus 4.8 high (--quality)
Adversarial review code-reviewer agent (model not resolved)
Blocking-fix Claude Opus 4.8 high
Orchestration Claude Opus 4.8 (1M context)
Verification CI verify pending

Land three related okfmem changes together on one umbrella branch:

- fix(badge): scratch/temp file writes no longer count as "work" toward
  the save-state badge, so a session that only touches throwaway files
  isn't nagged to save.
- feat(status): `okfmem status` gains a per-project inventory section
  (page/archive counts) surfaced directly from the engine.
- feat(installer): install/uninstall scripts pre-grant Antigravity/agy
  trust for the store path via `~/.gemini/trustedFolders.json`, gated
  on user consent, with matching uninstall cleanup.

Resolves #49
Resolves #43
Resolves #42
@s-annam
s-annam force-pushed the save-badge-status-agy-batch branch from 2b2504b to 38c05d4 Compare July 24, 2026 20:35
@s-annam

s-annam commented Jul 24, 2026

Copy link
Copy Markdown
Owner Author

Windows testing

Pulled the branch and ran the full gate on Windows 11 / PowerShell — reproduced the red build (windows-latest) check locally, fixed it, verified green.

Root cause of the CI failure

tests/test_agy_grant.py hardcoded the POSIX store key /store/okfmem-store and compared against it raw. But grant_agy_store_access / revoke_agy_store_access / agy_grant_state all normalize the store path with os.path.abspath(os.path.expanduser(...)), which on Windows prepends the drive — D:\store\okfmem-store on the CI runner, C:\store\okfmem-store locally. Production code was correct; the tests were not portable (same class of footgun as the encode_root round-trip guard).

Fix

Added KEY = os.path.abspath(os.path.expanduser(STORE)) and compare/seed against KEY instead of the raw POSIX literal. Two tests (test_revoke_removes_only_our_entry, test_revoke_dry_run_writes_nothing) had been passing by accident — the raw-key lookup early-returned as a no-op, never exercising the revoke/dry-run path — so those were switched to KEY too and now test the real behavior. No production code touched.

Verified on Windows

  • python -m pytest -q244 passed, 3 skipped (was 5 failed) — test_agy_grant.py 12/12 green
  • python scripts/check-leaks.py → clean, 64 tracked files
  • Smoke — okfmem status: add per-project inventory to the engine (page/archive counts, cwd->project, MEMORY.md limit) #43 status inventory renders correctly on Windows:
    • okfmem status — per-project pages:/MEMORY.md:/archived:/STATE: columns, * cwd→project marker on okfmem, ! over 200-line auto-load limit firing only where MEMORY.md > 200, decay: epoch … line, + N more truncation hint
    • okfmem status --all — all 14 projects listed, no truncation, aligned columns

CI after amend

build (windows-latest) pass, build (ubuntu-latest) pass, verify pass. Amended into the single commit (2b2504b38c05d4), force-push-with-lease, one-commit-per-PR preserved.

@s-annam
s-annam merged commit 7575c8b into main Jul 24, 2026
3 checks passed
@s-annam
s-annam deleted the save-badge-status-agy-batch branch July 24, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant