Repository navigation
Conversation
Greptile SummaryThis PR fixes a silent message-loss bug in the fallback-retry path:
Confidence Score: 5/5Safe to merge — the fix is correct and well-reasoned; only minor style clean-up remains. No P0 or P1 issues found. The behavioural change (always send original body instead of recovery prompt) is the intended fix and is sound. The only remaining findings are P2 style notes: dead code left behind after the simplification and a duplicate test case. Neither affects correctness or runtime behaviour. No files require special attention; the dead-code and duplicate-test observations are minor clean-up suggestions.
|
| Filename | Overview |
|---|---|
| src/agents/command/attempt-execution.ts | Removed the recovery-prompt substitution in resolveFallbackRetryPrompt; now always returns params.body. Dead code branch left behind at line 129. |
| src/agents/command/attempt-execution.test.ts | Updated test expectation to verify original body is preserved; introduced a duplicate test case for the sessionHasHistory=false scenario. |
Comments Outside Diff (1)
-
src/agents/command/attempt-execution.test.ts, line 66-74 (link)This test (
isFallbackRetry: true, sessionHasHistory: false) is identical in parameters and expected result to the one at lines 29–37 ("preserves original body for fallback retry when session has no history (subagent spawn)"). One of them can be removed to keep the suite non-redundant.Prompt To Fix With AI
This is a comment left during a code review. Path: src/agents/command/attempt-execution.test.ts Line: 66-74 Comment: **Duplicate test case** This test (`isFallbackRetry: true, sessionHasHistory: false`) is identical in parameters and expected result to the one at lines 29–37 ("preserves original body for fallback retry when session has no history (subagent spawn)"). One of them can be removed to keep the suite non-redundant. How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/command/attempt-execution.ts
Line: 129-131
Comment:
**Dead code branch after the fix**
After this change, `resolveFallbackRetryPrompt` always returns `params.body` regardless of `sessionHasHistory`. The early-return guard at line 129 is now a no-op — it returns the same value as the final `return params.body` on line 142. The function can be simplified:
```suggestion
return params.body;
```
(and the `sessionHasHistory` parameter can be dropped from both the function signature and its call-site in `runAgentAttempt`, along with the now-wasted `await sessionFileHasContent(sessionFile)` in `agent-command.ts`)
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: src/agents/command/attempt-execution.test.ts
Line: 66-74
Comment:
**Duplicate test case**
This test (`isFallbackRetry: true, sessionHasHistory: false`) is identical in parameters and expected result to the one at lines 29–37 ("preserves original body for fallback retry when session has no history (subagent spawn)"). One of them can be removed to keep the suite non-redundant.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix: preserve original message body on f..." | Re-trigger Greptile
| if (!params.sessionHasHistory) { | ||
| return params.body; | ||
| } |
There was a problem hiding this comment.
Dead code branch after the fix
After this change, resolveFallbackRetryPrompt always returns params.body regardless of sessionHasHistory. The early-return guard at line 129 is now a no-op — it returns the same value as the final return params.body on line 142. The function can be simplified:
| if (!params.sessionHasHistory) { | |
| return params.body; | |
| } | |
| return params.body; |
(and the sessionHasHistory parameter can be dropped from both the function signature and its call-site in runAgentAttempt, along with the now-wasted await sessionFileHasContent(sessionFile) in agent-command.ts)
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/command/attempt-execution.ts
Line: 129-131
Comment:
**Dead code branch after the fix**
After this change, `resolveFallbackRetryPrompt` always returns `params.body` regardless of `sessionHasHistory`. The early-return guard at line 129 is now a no-op — it returns the same value as the final `return params.body` on line 142. The function can be simplified:
```suggestion
return params.body;
```
(and the `sessionHasHistory` parameter can be dropped from both the function signature and its call-site in `runAgentAttempt`, along with the now-wasted `await sessionFileHasContent(sessionFile)` in `agent-command.ts`)
How can I resolve this? If you propose a fix, please make it concise.966a1b4 to
7585c1c
Compare
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 Fallback retry re-sends full user/task prompt, risking duplicate tool/command execution
Description
This can cause the same high-privilege instruction set to be presented again as a new prompt on retries (provider/model failover, timeout recovery), which can lead to:
Vulnerable code: if (!params.sessionHasHistory) {
return params.body;
}
...
return params.body;Because RecommendationRevert to not re-sending the full body when there is already persisted session history, or make retries explicitly non-repeating. Safer options:
export function resolveFallbackRetryPrompt(params: {
body: string;
isFallbackRetry: boolean;
sessionHasHistory?: boolean;
}): string {
if (!params.isFallbackRetry) return params.body;
if (!params.sessionHasHistory) return params.body;
return "Retry: continue from the transcript. Do not repeat actions already completed; inspect history and resume.";
}
This reduces risk of repeated commands or tool misuse caused by failover retries. Analyzed PR: #58301 at commit Last updated on: 2026-04-01T12:14:51Z |
7585c1c to
1e7ec3f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e7ec3f180
ℹ️ 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".
| // Preserving the original body is safe: the fallback model may see a | ||
| // duplicate in transcript history, but that is strictly preferable to losing | ||
| // the message content entirely. | ||
| return params.body; |
There was a problem hiding this comment.
Keep continuation prompt when retry already has history
On fallback retries where sessionHasHistory is true, this now returns the original task body, which re-injects the full user request as a new turn instead of a continuation cue. The fallback loop is explicitly designed to avoid duplicate user-message injection (src/agents/agent-command.ts:750-752), so this change can cause duplicate execution of side-effecting work when failover happens after history is already persisted. The original-body path should remain limited to retries without persisted history.
Useful? React with 👍 / 👎.
resolveFallbackRetryPrompt() replaced the message body with a generic "Continue where you left off..." recovery prompt when sessionHasHistory was true. For inter-agent sessions_send messages, this silently discarded the actual task content, breaking multi-agent communication. Always return the original body on fallback retries instead of substituting the recovery prompt. Closes openclaw#58219
1e7ec3f to
f02de46
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f02de46ab9
ℹ️ 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".
| // Preserving the original body is safe: the fallback model may see a | ||
| // duplicate in transcript history, but that is strictly preferable to losing | ||
| // the message content entirely. | ||
| return params.body; |
There was a problem hiding this comment.
Restore continuation prompt when history already exists
Returning params.body on every fallback retry re-injects the original user task into the same session for each model candidate, which can cause duplicate execution of side-effecting instructions when the first model already received the prompt but failed (for example timeout/rate-limit after tool calls started). The fallback loop is explicitly tracking retry index to avoid this duplicate user-turn behavior, so this change regresses existing-session retries and can produce repeated actions instead of true continuation.
Useful? React with 👍 / 👎.
|
Superseded by #66029, which merged on April 14, 2026. Closing this older duplicate in favor of the landed fix. |
Summary
resolveFallbackRetryPrompt()replaced the message body with a generic "Continue where you left off..." recovery prompt whensessionHasHistorywas true. For inter-agentsessions_sendmessages, this silently discarded the actual task content, breaking multi-agent communication.Changes
src/agents/command/attempt-execution.ts: ModifiedresolveFallbackRetryPrompt()to always preserve the original body.src/agents/command/attempt-execution.test.ts: Updated test expectation to verify original body is preserved.Closes #58219