Fix batch: YAML round-trip + state self-heal, branch validation, lifecycle reload, committer extensions - #4
Merged
Merged
Conversation
added 3 commits
August 17, 2026 14:41
serializeYaml now escapes embedded double quotes and backslashes when quoting, and parseYaml honors escaped quotes inside double-quoted regions, so every value round-trips — including values with quotes, backslashes, and unquoted-hash content, now all covered by the property tests. MemoryState.load() migrates pre-comment-support state.yaml files: unquoted scalars containing '#' are quoted before parsing, and the file is rewritten in canonical form on first load. Unreadable or read-only state files no longer throw out of load(). Found by a Grok 4.6 adversarial review (PR #3 follow-up bug hunt) and independently reproduced.
Branch names are validated at create, switch, and merge: names containing '/', '\', empty, or starting with '.' are rejected with a clear tool error instead of escaping .memory/branches/ (e.g. '../x' wrote outside the directory and 'feat/auth' corrupted listBranches). The memory_branch handler catches thrown errors so they surface as tool results, not raw exceptions. turn_end and session_before_compact now call tryLoad(ctx), so OTA logging works after a mid-session brain-init and appends to the current project's log after a cwd change instead of the previous project's. Reloading on cwd change also clears the frozen status snapshot so one project's injected status cannot leak into another. Found by a Grok 4.6 adversarial review and independently reproduced.
.memory/config.yaml accepts committer.extensions as a list or comma-separated string; each spec becomes an --extension arg on the committer child so custom-provider models work under --no-extensions (explicit -e paths bypass discovery disabling). Session extensions are deliberately not forwarded, preserving committer isolation. resolveAgentPrompt uses fileURLToPath so checkout paths with spaces no longer keep %20 and miss memory-committer.md. README now documents the two registered tools (memory_commit, memory_branch) instead of five tools that do not exist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes all six findings from the Grok 4.6 adversarial review of #3 plus a whole-repo bug hunt. Every fix was reproduced before implementation and independently verified after (runtime probes + mutation checks) by the delivery owner.
1. YAML correctness + legacy state self-heal
serializeYamlescapes embedded"and\\when quoting;parseYamlhonors escaped quotes in double-quoted regions — all values round-trip (property tests now cover",\\,#).MemoryState.load()quotes legacy unquoted#scalars before parsing (oldsummary: Fixes #1no longer truncates) and rewrites the file canonically on first load. Read-only/missing files never throw.2. Branch name validation
/,\\, empty, and leading-.names rejected at create/switch/merge with a clear tool error.../xpreviously wrote outside.memory/branches/;feat/authcorruptedlistBranches().3. Lifecycle reload
turn_endandsession_before_compactcalltryLoad(ctx): OTA logging works after mid-sessionbrain-init, and a cwd change appends to the new project's log instead of the old one's.frozenStatusSnapshot(no cross-project status leak).4. Committer extension passthrough
committer.extensionsin.memory/config.yaml(list or comma string) →--extensionargs on the child, so custom-provider committer models work under--no-extensions. Session extensions deliberately not forwarded (isolation preserved). Documented in SKILL.md + init skeleton.5. Space-safe module resolution
resolveAgentPromptusesfileURLToPath; paths with spaces no longer fail every commit via%20.6. README honesty
memory_commit,memory_branch) instead of five nonexistent ones.Evidence: 214 tests / 14 files green,
pnpm run checkall green (lint, typecheck, format, knip, jscpd, gitleaks). Mutation spot-checks: removing the snapshot reset or branch validation turns the corresponding tests red. aislop clean; slop-scan flags adjudicated (pre-existing shifted catch blocks + two intentional commented catches).