fix(scripts): salience_phase0.sh — flyctl ssh -C is exec, not shell#151
Merged
Conversation
Two bugs in cmd_snapshot caught on first real run:
1. `flyctl ssh -C "cmd && echo done"` doesn't interpret `&&` as a
shell operator. flyctl execs the command directly (no `sh -c`
wrapper), so `&&` and following tokens get passed as literal
args to the first command. cp ended up with:
cp /data/default.vec.npz /tmp/snap.vec.npz "vec copy done"
…and tried to use "vec copy done" as a destination directory,
which doesn't exist → error.
Fix: drop the `&& echo X` confirmation. Single command only.
If chaining is needed in future, wrap in `sh -c "..."` explicitly.
2. Error handling pattern was wrong — `flyctl ... || echo_warn`
followed by an unconditional `echo_ok` printed BOTH the warning
AND the success line on failure:
⚠ remote vecstore copy failed — embedding signals will be zero
✓ remote /tmp/snap.vec.npz written ← false!
Fix: switch from `cmd || warn` (followed by unconditional ok) to
`if cmd; then ok; else warn; fi`. Applied to both Step 2 (vec
copy) and Step 4 (remote cleanup) — same pattern bug.
After this fix, re-running `scripts/salience_phase0.sh snapshot`
will:
- Step 2: cp succeeds cleanly, vec.npz lands in /tmp/snap.vec.npz
- Step 3: sftp pulls both files
- Result: snapshot has Vectors: ~2433 (matching live memories)
Then `scripts/salience_phase0.sh score` will use the embedding
signals (constraint_score, time_penalty) as designed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Two bugs in
cmd_snapshotcaught on first real prod-snapshot run:Bug 1: flyctl ssh -C doesn't interpret shell operators
flyctl ssh console -a X -C "cp A B && echo done"execs the command directly without ash -cwrapper. So&&and following tokens become literal args tocp:The python -c command in Step 1 (sqlite backup) worked fine because it was a single command + single quoted arg — no shell operators involved.
Fix: drop the
&& echo Xconfirmation from Step 2's cp invocation. Single command only. If chaining is needed in future, wrap insh -c "..."explicitly.Bug 2: success message printed unconditionally even on failure
Resulted in contradictory output during the live run:
Fix: switch from
cmd || warn(followed by unconditional ok) toif cmd; then ok; else warn; fi. Applied to Step 2 (vec copy) AND Step 4 (remote cleanup) — same pattern bug at both sites.After this fix
git checkout main && git pull scripts/salience_phase0.sh snapshotExpected output:
✓ remote /tmp/snap.vec.npz written(and ONLY this line — no contradictory warn)downloaded sqlite=8036352B vec.npz=~3000000BVectors: ~2433(matchingLive memories: 2433)Then
scripts/salience_phase0.sh scorewill use the embedding signals (constraint_score, time_penalty) as designed — picks should look fundamentally different from the all-zeros-c-and-tp output you saw.Verified
bash -nclean🤖 Generated with Claude Code