fix: refresh after failed mutating exec runs#59
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac74e5a1d9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (preparedSessionMemory) { | ||
| await finalizeSessionMemoryRun(root, flags.sessionRecord, preparedSessionMemory, result, config); | ||
| } | ||
| return result; |
There was a problem hiding this comment.
Continue validation when refresh fails without strict mode
This catch block now always returns refresh-error, even when --fail-on-stale is not set, so validateRepo() is skipped for every refresh failure. In the previous flow, non-strict runs continued to validation and still reported stale/unsafe changes after a partial refresh; with this change, those checks are never emitted and session records show validation as not run. Please keep the early return only for strict failure cases and let non-strict runs fall through to validation while preserving the wrapped command's exit code.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Summary
- Updated
runExecso refresh failures only short-circuit withphase: "refresh-error"in the strict stale-check case (--fail-on-stalewith a non-failing wrapped command). Non-strict paths now continue throughvalidateRepo()and preserve the wrapped command’s exit code behavior. src/core/exec.jsL292-L327 - Preserved refresh failure context for non-strict runs by appending the refresh error message into the returned
stderrwhile still returningphase: "complete"with validation results. src/core/exec.jsL330-L338 - Added a regression test that simulates a failing mutating command plus a refresh-time error, and verifies non-strict exec still validates and keeps the command exit code. test/exec.test.jsL154-L192
Testing
- ✅
node --test test/exec.test.js ⚠️ node --test test/main.test.js(one unrelated failing test in this environment:runCli doctor reports MemPalace available via AGENTIFY_MEMPALACE_CMD)
Committed on the current branch (46118d1) and created a follow-up PR with title “fix: continue exec validation after non-strict refresh errors”.
Summary
runExecdetects repository mutationsrunExecandagentify exec --fail-on-stalewhen a failing command edits tracked filesTesting
node --test test/exec.test.jsnode --test test/main.test.jsnpm testFixes #48