Repository navigation
Conversation
Greptile SummaryThis PR fixes Confidence Score: 5/5Safe to merge — the core fix is correct and well-tested; the only finding is a P2 test performance antipattern in the new test file. All findings are P2 (test style). The production code changes in exec-approval-reply.ts and dispatch-from-config.ts are correct, minimal, and consistent with existing patterns. No logic, security, or data-integrity concerns. src/auto-reply/reply/dispatch-from-config.tool-only.test.ts — minor vi.resetModules() antipattern per project guidelines, but does not affect correctness. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/auto-reply/reply/dispatch-from-config.tool-only.test.ts
Line: 237-246
Comment:
**`vi.resetModules()` + `await import()` in `beforeEach` antipattern**
This file uses `vi.hoisted(...)` for static mock definitions but then calls `vi.resetModules()` and reimports four heavy modules (`dispatch-from-config`, `inbound-dedupe`, `acp/control-plane/manager`, `plugins/conversation-binding`) in every `beforeEach`. The project guidelines call this out explicitly as a test performance antipattern: `acpManagerTesting.resetAcpSessionManagerForTests()` and `pluginBindingTesting.reset()` can be called on statically-imported references without module teardown. Consider importing once in `beforeAll` and resetting mock state + calling the `__testing` reset functions directly in `beforeEach` instead.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(agents): add channelData marker to e..." | Re-trigger Greptile |
| let acpManagerTesting: typeof import("../../acp/control-plane/manager.js").__testing; | ||
| let pluginBindingTesting: typeof import("../../plugins/conversation-binding.js").__testing; | ||
|
|
||
| function createDispatcher(): ReplyDispatcher { | ||
| return { | ||
| sendToolResult: vi.fn(() => true), | ||
| sendBlockReply: vi.fn(() => true), | ||
| sendFinalReply: vi.fn(() => true), | ||
| waitForIdle: vi.fn(async () => {}), | ||
| getQueuedCounts: vi.fn(() => ({ tool: 0, block: 0, final: 0 })), |
There was a problem hiding this comment.
vi.resetModules() + await import() in beforeEach antipattern
This file uses vi.hoisted(...) for static mock definitions but then calls vi.resetModules() and reimports four heavy modules (dispatch-from-config, inbound-dedupe, acp/control-plane/manager, plugins/conversation-binding) in every beforeEach. The project guidelines call this out explicitly as a test performance antipattern: acpManagerTesting.resetAcpSessionManagerForTests() and pluginBindingTesting.reset() can be called on statically-imported references without module teardown. Consider importing once in beforeAll and resetting mock state + calling the __testing reset functions directly in beforeEach instead.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/dispatch-from-config.tool-only.test.ts
Line: 237-246
Comment:
**`vi.resetModules()` + `await import()` in `beforeEach` antipattern**
This file uses `vi.hoisted(...)` for static mock definitions but then calls `vi.resetModules()` and reimports four heavy modules (`dispatch-from-config`, `inbound-dedupe`, `acp/control-plane/manager`, `plugins/conversation-binding`) in every `beforeEach`. The project guidelines call this out explicitly as a test performance antipattern: `acpManagerTesting.resetAcpSessionManagerForTests()` and `pluginBindingTesting.reset()` can be called on statically-imported references without module teardown. Consider importing once in `beforeAll` and resetting mock state + calling the `__testing` reset functions directly in `beforeEach` instead.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Fixed — moved dynamic imports to beforeAll and removed vi.resetModules() from beforeEach. The beforeEach now only resets mock state and calls __testing reset functions. Pushed in amended commit.
d5ee9bc to
e9453d1
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9453d11f5
ℹ️ 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".
| vi.resetModules(); | ||
| ({ dispatchReplyFromConfig } = await import("./dispatch-from-config.js")); | ||
| ({ resetInboundDedupe } = await import("./inbound-dedupe.js")); | ||
| ({ __testing: acpManagerTesting } = await import("../../acp/control-plane/manager.js")); |
There was a problem hiding this comment.
Stop resetting and re-importing dispatch module per test
AGENTS.md explicitly warns against vi.resetModules() plus await import(...) inside beforeEach for heavy modules, and this new suite does both for dispatch-from-config on every case. That forces repeated module-graph reloads in a known hotspot test surface, which increases CI runtime and memory pressure without improving coverage; this setup should be switched to one-time imports (or beforeAll) with per-test mock/state resets instead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the same push — vi.resetModules() removed, imports moved to beforeAll, beforeEach only resets mock state now.
…oads buildExecApprovalUnavailableReplyPayload returns text-only payloads with no channelData marker. This makes them indistinguishable from regular assistant text in delivery gates (e.g. the proposed replyMode tool-only gate in #57914, and the existing resolveToolDeliveryPayload group/native flow). Without a marker, these payloads are silently dropped, which causes a total blackout: deterministicApprovalPromptSent is set despite the message never reaching the user, then all subsequent assistant text is also suppressed. Fix: add channelData.execApprovalUnavailable with the reason to all return paths, and update resolveToolDeliveryPayload to recognize it. Co-authored-by: Aurora <[email protected]>
e9453d1 to
7f8251b
Compare
Update the tool-only replyMode gate to also pass through payloads with channelData.execApprovalUnavailable, matching the marker added in openclaw#60445. Without this, approval-unavailable notifications are silently dropped in tool-only mode, causing a total blackout. Co-authored-by: Aurora <[email protected]>
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open, but not merge-ready: current main still has the missing unavailable-approval marker problem, while this branch is now conflicting, lacks after-fix real behavior proof, and does not cover the newer shared approval-payload gates on main. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. So I’m closing this here because the remaining work is already tracked in the canonical issue. Review detailsBest possible solution: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main builds unavailable approval replies without channelData, while dispatch suppression gates recognize only Is this the best way to solve the issue? No. The marker is the right fix direction, but the current branch is stale and must update the shared current-main approval-payload gates rather than only the old local delivery branch. Security review: Security review cleared: The diff only changes TypeScript reply-payload routing and tests; it does not touch dependencies, workflows, secrets, permissions, install scripts, or generated code. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against c29e1fe764f3. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
buildExecApprovalUnavailableReplyPayloadreturns{ text: "..." }with nochannelDatamarker, making exec-approval-unavailable payloads indistinguishable from regular assistant text at delivery gates.resolveToolDeliveryPayloadgroup/native flow, and the proposedreplyMode: "tool-only"gate in feat(agents): add replyMode tool-only to suppress auto-delivery #57914), unmarked unavailable payloads are silently dropped. This causes a total blackout:deterministicApprovalPromptSentis set despite the message never reaching the user, then all subsequent assistant text is also suppressed.channelData.execApprovalUnavailablewith the typedreasonfield to all return paths ofbuildExecApprovalUnavailableReplyPayload, and updatedresolveToolDeliveryPayloadto recognize the new marker alongside the existingexecApprovalcheck.replyModetool-only gate (that remains in feat(agents): add replyMode tool-only to suppress auto-delivery #57914). No interface changes, no config changes, no new abstractions.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
replyMode: "tool-only"gate — this PR fixes a prerequisite payload marking issue)Root Cause / Regression History (if applicable)
buildExecApprovalUnavailableReplyPayloadwas implemented as text-only, while its siblingbuildExecApprovalPendingReplyPayloadcorrectly setschannelData.execApproval. The unavailable path was never gated before, so the missing marker was harmless until delivery gates that filter bychannelDatawere introduced.channelDatamarkers.onToolResultreturnsPromise<void>with no delivery confirmation.buildExecApprovalPendingReplyPayload(line 254) correctly setschannelData.execApproval. The unavailable builder (line 322) was likely written before thechannelData-based gating pattern was established.resolveToolDeliveryPayload(and the proposed tool-only gate) started filtering tool results bychannelDatashape.Regression Test Plan (if applicable)
src/infra/exec-approval-reply.tool-only.test.ts(6 tests for builder channelData),src/auto-reply/reply/dispatch-from-config.tool-only.test.ts(4 tests for delivery gate)buildExecApprovalUnavailableReplyPayloadalways produceschannelData.execApprovalUnavailablewith the correctreasonon ALL return paths (sentApproverDms and main).resolveToolDeliveryPayloadpasses unavailable payloads through instead of dropping them.exec-approval-reply.test.ts:329-339— updated fromtoEqual({ text })to include the newchannelData.User-visible / Behavior Changes
Diagram (if applicable)
Security Impact (required)
Repro + Verification
Environment
execApprovalsconfigured but no approval route availableSteps
Expected
Actual
deterministicApprovalPromptSentsilences everythingEvidence
exec-approval-reply.test.ts:329-339(wastoEqual({ text }), now includeschannelData)exec-approval-reply.tool-only.test.ts, 4 indispatch-from-config.tool-only.test.tsHuman Verification (required)
pi-embedded-subscribehandlers (requires full PI runtime). Runtime verification on a live instance pending.Review Conversations
Compatibility / Migration
Risks and Mitigations
Risk:
shouldSuppressLocalExecApprovalPromptinexec-approval-local.tspasseshint.kind: "approval-pending"for all payloads including unavailable ones. If a future plugin useshint.kindfor suppression decisions, unavailable payloads could be incorrectly suppressed.shouldSuppressLocalPayloadPrompt. ThechannelDatamarker (execApprovalUnavailablevsexecApproval) provides a reliable distinguishing mechanism at the payload level. Tracked as tech debt TD-1 for a futurehint.kind: "approval-unavailable"addition.Risk:
onToolResultreturnsPromise<void>— no delivery confirmation.deterministicApprovalPromptSentis set regardless of whether delivery succeeded.execApprovalUnavailablepayload passes through gates. The generalonToolResultdelivery confirmation gap is tracked as tech debt TD-2.