Repository navigation
Conversation
Greptile SummaryAdds post-timeout compensation to Confidence Score: 5/5Safe to merge — logic is correct, all targeted tests pass, and the only findings are minor observability suggestions. Both findings are P2: a misleading constant comment and a dropped error string on an already-rare fallback path. Neither affects correctness or the stated behavior contract. No files require special attention.
|
| /** | ||
| * Default reply history limit used for post-timeout compensation reads. | ||
| * Must match SESSIONS_SEND_REPLY_HISTORY_LIMIT in sessions-send-tool.ts. | ||
| */ | ||
| const COMPENSATE_REPLY_HISTORY_LIMIT = 50; |
There was a problem hiding this comment.
Misleading "must match" comment on default constant
The comment says COMPENSATE_REPLY_HISTORY_LIMIT must match SESSIONS_SEND_REPLY_HISTORY_LIMIT in sessions-send-tool.ts, but the primary caller always passes limit explicitly, so this default is never used on that code path. Someone changing SESSIONS_SEND_REPLY_HISTORY_LIMIT might not realize the default here matters (or vice versa). Consider rephrasing to reflect that this is just a fallback for direct callers that omit limit.
| /** | |
| * Default reply history limit used for post-timeout compensation reads. | |
| * Must match SESSIONS_SEND_REPLY_HISTORY_LIMIT in sessions-send-tool.ts. | |
| */ | |
| const COMPENSATE_REPLY_HISTORY_LIMIT = 50; | |
| /** | |
| * Fallback reply history limit for post-timeout compensation reads when | |
| * the caller does not supply an explicit {@link compensateAfterWaitTimeout.params.limit}. | |
| * The primary call site in sessions-send-tool.ts always passes the limit explicitly. | |
| */ | |
| const COMPENSATE_REPLY_HISTORY_LIMIT = 50; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/run-wait.ts
Line: 221-225
Comment:
**Misleading "must match" comment on default constant**
The comment says `COMPENSATE_REPLY_HISTORY_LIMIT` must match `SESSIONS_SEND_REPLY_HISTORY_LIMIT` in `sessions-send-tool.ts`, but the primary caller always passes `limit` explicitly, so this default is never used on that code path. Someone changing `SESSIONS_SEND_REPLY_HISTORY_LIMIT` might not realize the default here matters (or vice versa). Consider rephrasing to reflect that this is just a fallback for direct callers that omit `limit`.
```suggestion
/**
* Fallback reply history limit for post-timeout compensation reads when
* the caller does not supply an explicit {@link compensateAfterWaitTimeout.params.limit}.
* The primary call site in sessions-send-tool.ts always passes the limit explicitly.
*/
const COMPENSATE_REPLY_HISTORY_LIMIT = 50;
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c42105c1e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return { | ||
| newReply: hasNewReply ? latestReply.text : undefined, | ||
| accepted: true, | ||
| delivery: { | ||
| status: "accepted", |
There was a problem hiding this comment.
Avoid marking all timeout compensations as accepted
compensateAfterWaitTimeout treats any successful chat.history read as proof of acceptance, so the timeout branch in sessions_send will return status: "accepted" for nearly every agent.wait timeout unless the history read itself fails. That can misclassify real delivery uncertainty (for example, a run that never actually started or an invalid run id that only times out) as accepted, which hides the timeout signal callers need for retry/diagnostics. Keep the timeout result when compensation cannot produce concrete evidence of acceptance (such as a new post-baseline reply).
Useful? React with 👍 / 👎.
|
+1. The post-timeout compensation flow addresses a sessions_send multi-minute lag pattern we've also observed in production, where the parent session moves on after the soft cutoff but the underlying spawn keeps running unobserved. The compensation logic looks correct. |
|
Codex review: needs real behavior proof before merge. Reviewed July 3, 2026, 2:25 AM ET / 06:25 UTC. Summary PR surface: Source +79, Tests +210. Total +289 across 4 files. Reproducibility: yes. Source inspection shows current main returns non- Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Refresh or supersede this branch with a current-main patch that compensates only non-terminal wait-window timeouts, preserves pending-error and terminal-timeout precedence plus delivery metadata, and includes redacted real after-fix proof for the timeout edge. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main returns non- Is this the best way to solve the issue? No, not as submitted. The fix belongs at the Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4e6933c84f18. Label changesLabel justifications:
Evidence reviewedPR surface: Source +79, Tests +210. Total +289 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
@clawsweeper re-review Real behavior proof has been added to the PR body with redacted host output, exact commands, observed result, and explicit untested scope. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
sessions_send with a non-zero timeout previously returned status=timeout whenever the wait window expired, even when the target agent had already accepted the message and produced a reply after the window closed. Adds compensateAfterWaitTimeout() that reads the latest assistant reply snapshot after a timeout and checks whether a new reply materialized since the pre-send baseline.
6c42105 to
6e43ccc
Compare
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@glfruit thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
|
Closing per ClawSweeper review verdict |
Fixes #68065
sessions_sendwith a non-zero timeout previously returnedstatus=timeoutwhenever the wait window expired, even when the target agent had already accepted the message and produced a reply after the window closed.Behavior contract
status: "timeout"status: "ok"with the late replystatus: "timeout"status: "accepted"status: "timeout"status: "timeout"(unchanged)timeoutSeconds: 0)status: "accepted"status: "accepted"(unchanged)Implementation
Adds
compensateAfterWaitTimeout()insrc/agents/run-wait.tsthat reads the latest assistant reply snapshot after a timeout and checks whether a new reply materialized since the pre-send baseline. The timeout handler insessions-send-tool.tsnow calls this before returning a hard timeout.Test coverage
src/agents/run-wait.test.ts— 3 new tests in acompensateAfterWaitTimeoutdescribe block:acceptedwith replyacceptedwithout replysrc/agents/tools/sessions.test.ts— 1 new test: fire-and-forget (timeoutSeconds=0) stays on theacceptedpath without triggering compensation oragent.waitProduction provenance
We have been running this fix as a dist-level patch in production. This PR is the source-level equivalent, adapted to the current upstream main branch. Reference third-party implementation: wade-microblueworld/openclaw@bfe3a59
Note on full test suite
The full
pnpm testrun has 2 pre-existing failures on upstreammainthat are unrelated to this change (src/plugins/bundle-commands.test.ts,src/commands/gateway-status/helpers.test.ts). All files touched by this PR pass cleanly.Real behavior proof
sessions_sendpost-timeout compensation should preserve canonical delivery metadata and should expose compensation read failures instead of hiding them behind a generic timeout./tmp/openclaw-pr68196, Node v25.8.1, branchfix/sessions-send-timeout-compensation, commit37c9ac3c48a.Observed result after fix: The regression coverage now verifies that accepted timeout compensation keeps
delivery: { status: "pending", mode: "announce" }, skipped compensation keeps skipped announce metadata, and terminal timeout errors include the compensation read failure text.What was not tested: Live Telegram or Feishu channel delivery was not exercised for this PR because the changed behavior is the
sessions_sendtool result/compensation contract.Behavior or issue addressed:
sessions_sendshould not report a hard send failure when the firstagent.waittimes out but the nested agent run has already been accepted and can still produce a reply. The caller should get either the late reply or an accepted/pending delivery state instead of a misleading failure.Real environment tested: macOS production OpenClaw host running the owned package install (
@glfruit/[email protected]) with the live gateway up and both Telegram and Feishu transports configured. Source branch under proof:fix/sessions-send-timeout-compensationat6e43ccce881.Exact steps or command run after this patch:
openclaw --version,npm list -g --depth=0 @glfruit/openclaw --registry=http://127.0.0.1:4873,curl -sS http://127.0.0.1:18789/readyz.git show glfruit/fix/sessions-send-timeout-compensation:src/agents/tools/sessions-send-tool.tsandgit show glfruit/fix/sessions-send-timeout-compensation:src/agents/run-wait.ts.src/agents/run-wait.test.tsandsrc/agents/tools/sessions.test.ts, which cover late-reply compensation, accepted-state compensation, and baseline reply filtering.Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output): terminal capture from the real host plus PR branch excerpt:
Observed result after fix: the patched path converts the ambiguous first-wait timeout into either
status: "ok"with the late reply orstatus: "accepted"with delivery noterun accepted, no reply within timeout, rather than surfacing the first wait timeout as a hard send failure.What was not tested: I did not post private production chat transcripts or intentionally force a mutating timeout in the live Telegram/Feishu rooms. The live host evidence verifies the real runtime context; the exact timeout edge is covered by the PR branch regression tests and source-level trace above.
Before evidence (optional but encouraged): [Bug]: sessions_send misclassifies first agent.wait timeout as hard send failure #68065 describes the production failure mode: the first
agent.waittimeout could be misclassified as a hardsessions_sendfailure even though the target run had been accepted.