fix(pulse): resolve pai-root-relative targetFile in applyProposalEdit (memory-proposal apply fails)#1507
Closed
anikinsasha wants to merge 1 commit into
Closed
Conversation
Memory-proposal apply failed with 'target file missing: LIFEOS/USER/CONFIG/OPERATIONAL_RULES.md' even though the file exists. applyProposalEdit received a pai-root-relative target_file and passed it straight to existsSync/readFileSync/renameSync, which resolve against process.cwd(). The Telegram bot runs from LIFEOS/PULSE, so the relative path never resolved and every 'yes'/'edit' ratification errored out. Resolve targetFile against ~/.claude (matching the file's existing HOME/.claude convention) when it is not already absolute.
Owner
|
Ported to the private source tree with credit. Thank you. One adaptation: the Telegram surfacing channel was removed on 2026-07-15, so Closing instead of merging because the public repo is a generated artifact; a direct merge here would be silently overwritten at the next release. Your fix ships in that release, credited in the commit. |
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.
Problem
Applying a memory-system proposal from Telegram (
yes #<id>/edit #<id>) always fails with:…even though the target file exists.
Root cause
applyProposalEdit(targetFile, editText)receives a pai-root-relativetarget_file(e.g.LIFEOS/USER/CONFIG/OPERATIONAL_RULES.md, as stored on the proposal) and passes it straight toexistsSync/readFileSync/renameSync, which resolve relative paths againstprocess.cwd(). The Telegram bot runs fromLIFEOS/PULSE(its launchdWorkingDirectory), so the path resolves to a nonexistent nested location and the existence check fails. This breaks proposal ratification for any standard install.Fix
Resolve
targetFileagainst~/.claudewhen it isn't already absolute — matching theHOME/.claudeconvention this file already uses a few lines up (forOBS_DIR). One resolution line plus anisAbsoluteimport; all file ops use the resolved path.Repro
yes #<id>.target file missing. After: the rule is appended toOPERATIONAL_RULES.mdunder## Memory-System Proposals.Verified
Applied locally and called
applyProposalEdit("LIFEOS/USER/CONFIG/OPERATIONAL_RULES.md", …)→{ ok: true }; the rule landed correctly under the section header.