feat: add fast-lane override for immediate response execution#57239
feat: add fast-lane override for immediate response execution#57239vasujain00 wants to merge 8 commits into
Conversation
- Introduced `forceRunNowWhenActive` parameter to enable immediate execution of replies when certain conditions are met. - Implemented logic to determine fast-lane candidates based on message characteristics. - Updated queue policy to respect the new fast-lane behavior. - Added tests to verify the immediate run functionality when the fast-lane override is enabled.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cba0777c03
ℹ️ 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".
Greptile SummaryThis PR adds a fast-lane execution path that lets short, well-known messages (e.g. "yes", "no", "ok", "cancel") bypass the normal followup queue and respond immediately even while a long-running session turn is active. The mechanism creates a transient session context with a fresh session ID and appends a conciseness system prompt, then forces The intent is sound and the guard heuristics (
Two lower-priority observations:
Confidence Score: 3/5Not safe to merge as-is: two P1 logic issues need to be resolved first. The fast-lane queue drain race is a present concurrency defect on the changed path that can cause two concurrent embedded-agent runs against the same session key. The heartbeat ordering inversion in queue-policy.ts is a secondary but real logic error. Both P1 findings are in newly introduced code paths with no integration test coverage, consistent with the PR author's own risk acknowledgment. src/auto-reply/reply/get-reply-run.ts (queue drain race, transient file cleanup) and src/auto-reply/reply/queue-policy.ts (heartbeat check ordering)
|
| Filename | Overview |
|---|---|
| src/auto-reply/reply/get-reply-run.ts | Adds fast-lane detection and transient session construction; two P1-adjacent issues: shared queueKey on fast-lane completion can prematurely drain the followup queue while the main run is still active, and transient transcript files are never cleaned up. |
| src/auto-reply/reply/queue-policy.ts | Adds forceRunNowWhenActive override; the new check is inserted before the isHeartbeat drop guard, allowing heartbeat messages that match the fast-lane pattern to bypass the intended drop behavior. |
| src/auto-reply/reply/agent-runner.ts | Minimal change: threads forceRunNowWhenActive through the params interface and passes it to resolveActiveRunQueueAction. No logic changes in this file itself. |
| src/auto-reply/reply/queue-policy.test.ts | Adds one unit test covering the forceRunNowWhenActive → run-now path; test is correct and well-structured. |
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/queue-policy.ts
Line: 15-17
Comment:
**Fast-lane bypass precedes heartbeat drop check**
`forceRunNowWhenActive` is checked before `isHeartbeat`, so a heartbeat message that qualifies as a fast-lane candidate (e.g. if its body happens to match `FAST_LANE_QUICK_MESSAGE_PATTERN`) would return `"run-now"` instead of `"drop"`. In `get-reply-run.ts` there is no `!isHeartbeat` guard on `shouldUseFastLane`, only a `shouldFollowup` guard — but `shouldFollowup` can be `true` in `"collect"` mode even for heartbeats, leaving the heartbeat drop path unreachable for any fast-lane candidate.
The `isHeartbeat` → `"drop"` branch is a safety valve for stale pings; bypassing it via `forceRunNowWhenActive` is unintended.
```suggestion
if (!params.isActive) {
return "run-now";
}
if (params.isHeartbeat) {
return "drop";
}
if (params.forceRunNowWhenActive) {
return "run-now";
}
```
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/auto-reply/reply/get-reply-run.ts
Line: 607-634
Comment:
**Fast-lane completion can prematurely drain the shared followup queue**
When the fast-lane run completes it calls `finalizeWithFollowup(result, queueKey, runFollowupTurn)` using the same `queueKey` as the still-active main run. `finalizeWithFollowup` → `scheduleFollowupDrain` will start processing any items already enqueued under that key if the queue is not yet in a `draining` state — which it won't be, because the main run hasn't finished yet.
The result is that queued followup messages that were safely held until the main run completed can now be dispatched to the embedded runner while the main run is still live, creating two concurrent sessions on the same key.
A minimal mitigation would be to skip scheduling the drain when the caller knows the main run is still active, e.g. by passing `isRunActive` into `finalizeWithFollowup` for the fast-lane path, or by using a separate queue key for the transient run so its drain does not touch the primary lane.
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/auto-reply/reply/get-reply-run.ts
Line: 62-63
Comment:
**`"what time is it"` phrase seems out of place in the pattern**
The regex bundles generic conversational affirmations/cancellations (`yes`, `no`, `ok`, `cancel`, `stop`, etc.) with the oddly specific question `what time is it\??`. It appears to be a test phrase that was accidentally left in the production pattern. If intentional, a comment explaining why this one question warrants fast-lane treatment would help; if not, it should be removed.
```suggestion
const FAST_LANE_QUICK_MESSAGE_PATTERN =
/^(?:yes|no|ok|okay|sure|thanks|thx|got it|cancel|stop|never mind|nevermind)$/i;
```
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/auto-reply/reply/get-reply-run.ts
Line: 614-619
Comment:
**Transient session transcript files are never cleaned up**
`transientSessionFile` resolves to a `fastlane-<uuid>-topic-<...>.jsonl` file in the sessions directory. There is no TTL, post-run cleanup, or sweep mechanism for these files. In high-traffic Discord channels where many short messages arrive during long turns, these orphaned transcript files will accumulate on disk indefinitely.
Consider deleting the transient transcript after the fast-lane run finishes (in a `finally` block), or marking it with a prefix/suffix that a periodic pruning job can target.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "feat: add fast-lane override for immedia..." | Re-trigger Greptile
- Added file system cleanup for transient fast-lane session files after execution. - Updated queue policy to ensure heartbeat conditions take precedence over fast-lane overrides. - Modified the runPreparedReply function to handle session management more effectively during fast-lane execution. - Added a test case to validate the new heartbeat precedence behavior.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1cf3a995d5
ℹ️ 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".
- Replaced single fast-lane session file variable with an array to handle multiple files for cleanup. - Updated cleanup logic to iterate over the array of transient fast-lane files. - Maintained session key for proper system-event routing during fast-lane execution.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33b7b7b0e1
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33b7b7b0e1
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da8b1e8a99
ℹ️ 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".
- Introduced `sessionLaneKey` to `RunEmbeddedPiAgentParams` for optional command-lane key overrides. - Updated `runEmbeddedPiAgent` to utilize `sessionLaneKey` for improved session lane resolution. - Modified context building in `buildEmbeddedContextFromTemplate` to include `sessionLaneKey`. - Enhanced `runPreparedReply` to isolate command-lane serialization using `sessionLaneKey` for better queue management.
…m/vasujain00/openclaw into feature/session-fast-lane-replies
…reparedReply - Added `fastMode` property to `FollowupRun` type for improved configuration options. - Updated `runPreparedReply` to explicitly type `followupRun` as `FollowupRun` for better type safety.
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open: this is a useful implementation candidate for active-session reply latency, but current main has not implemented the requested fast-lane behavior, the linked design issue is still open, and this branch is conflicting with current reply-run contracts while lacking real behavior proof. Canonical path: Close this PR as superseded by #85709. So I’m closing this here and keeping the remaining discussion on #85709. Review detailsBest possible solution: Close this PR as superseded by #85709. Do we have a high-confidence way to reproduce the issue? Yes for the PR blockers: source inspection of the PR head against current main shows the removed reset contract, parent reply-operation key reuse, and sandbox key replacement. I did not run tests because this was a read-only review. Is this the best way to solve the issue? No. The fast-lane idea may be useful, but this implementation is not the narrow maintainable solution until it preserves current reply/session/runtime-policy contracts, enforces tool limits in code, and proves real active-session behavior. Security review: Security review needs attention: The diff introduces a parallel quick-turn path while changing sandbox/runtime-policy identity and relying on prompt-only tool suppression.
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against c643370fd85b. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
ClawSweeper applied the proposed close for this PR.
|
Summary
Why
Long-running turns currently block quick follow-up messages in the same session, which creates high perceived latency in fast chat channels (especially Discord). This change preserves the existing safe queue model for normal traffic while allowing low-risk, short messages to get timely responses during busy turns.
What changed
src/auto-reply/reply/get-reply-run.tssrc/auto-reply/reply/agent-runner.tsforceRunNowWhenActiveflag into queue-action selectionsrc/auto-reply/reply/queue-policy.tsforceRunNowWhenActiveby returningrun-noweven while activesrc/auto-reply/reply/queue-policy.test.tsBehavior notes
Verification
pnpm tsgo✅pnpm test -- src/auto-reply/reply/queue-policy.test.tsRisk / follow-up
get-reply-run/reply-flowReferences
Closes #56880