Skip to content

fix(cli): keep empty agent replies silent - #76427

Merged
vincentkoc merged 2 commits into
mainfrom
codex/fix-session-rpc-reply-routing
May 3, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
codex/fix-session-rpc-reply-routing

Conversation

@steipete

@steipete steipete commented May 3, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Keep gateway CLI agent responses silent when the final payload list is intentionally empty.
  • Keep embedded command delivery silent for empty payloads instead of logging No reply from agent.
  • Add regression coverage for gateway empty replies, ACP NO_REPLY turns, and direct delivery empty payloads.

Why

Channel-visible agents can legitimately send their user-facing output through tools such as message and then finish with no assistant payload. Treating that as a fallback text reply produces misleading output and can make session/RPC callers look like they responded incorrectly.

Validation

  • pnpm test src/commands/agent-via-gateway.test.ts src/commands/agent.delivery.test.ts src/commands/agent.acp.test.ts
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md src/commands/agent-via-gateway.ts src/agents/command/delivery.ts src/commands/agent-via-gateway.test.ts src/commands/agent.delivery.test.ts src/commands/agent.acp.test.ts
  • git diff --check

Notes

  • pnpm changed:lanes --json selected core + coreTests.
  • Broader pnpm check:changed was not run because Testbox is not authenticated here (blacksmith auth login required), and repo policy says broad changed gates should run in Testbox on maintainer machines.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels May 3, 2026
@clawsweeper

clawsweeper Bot commented May 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR removes empty-reply fallback logging from Gateway and embedded agent CLI delivery, preserves non-ok Gateway summaries, adds focused regression tests, and adds a changelog entry.

Reproducibility: yes. Source inspection on current main shows Gateway empty payloads log the summary/fallback and embedded delivery empty payloads log No reply from agent.; ACP silent turns can produce empty payloads that reach delivery.

Next step before merge
No narrow automated repair remains after the follow-up commit; the next step is maintainer review, exact-head validation, and deciding when the draft is ready to land.

Security
Cleared: No concrete security or supply-chain concern found; the diff is limited to command output handling, focused tests, and changelog text.

Review details

Best possible solution:

Land the guarded empty-reply suppression with the regression tests and changelog once maintainer review and exact-head validation are satisfied.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection on current main shows Gateway empty payloads log the summary/fallback and embedded delivery empty payloads log No reply from agent.; ACP silent turns can produce empty payloads that reach delivery.

Is this the best way to solve the issue?

Yes. The latest PR narrows Gateway silence to successful empty replies, preserves non-ok terminal summaries, and removes the misleading embedded delivery fallback for intentional empty payloads.

Acceptance criteria:

  • pnpm test src/commands/agent-via-gateway.test.ts src/commands/agent.delivery.test.ts src/commands/agent.acp.test.ts
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md src/commands/agent-via-gateway.ts src/agents/command/delivery.ts src/commands/agent-via-gateway.test.ts src/commands/agent.delivery.test.ts src/commands/agent.acp.test.ts
  • git diff --check
  • Testbox changed gate on exact head if maintainer proceeds to merge

What I checked:

  • Current Gateway CLI empty-payload behavior: Current main logs the Gateway summary or No reply from agent. whenever non-JSON Gateway responses have an empty payload list. (src/commands/agent-via-gateway.ts:203, 140c274335d6)
  • Current embedded/direct delivery empty-payload behavior: Current main logs No reply from agent. before returning an empty delivery result when payloads are absent or empty. (src/agents/command/delivery.ts:352, 140c274335d6)
  • ACP empty replies flow into delivery: ACP turns build payloads from the finalized visible text and then pass the result to deliverAgentCommandResult, so exact silent turns can reach the same empty-payload delivery branch. (src/agents/agent-command.ts:595, 140c274335d6)
  • Gateway timeout summaries must stay visible: Gateway agent completion maps aborted embedded results to a successful final frame with status: "timeout" and summary: "aborted", which supports the PR's status guard for non-ok empty responses. (src/gateway/server-methods/agent.ts:453, 140c274335d6)
  • Latest PR patch preserves non-ok summaries: The provided latest PR diff changes the Gateway empty-payload branch to log only when response?.status !== "ok", and adds a regression test for status: "timeout" with summary: "aborted". (src/commands/agent-via-gateway.ts:203, e28e67851bb9)
  • Related merged PR is adjacent, not superseding: The related merged PR fix(agents): keep delayed sessions_send replies alive #76484 explicitly describes this PR as adjacent empty-payload CLI/delivery behavior and separate from its sessions_send timeout fix. (3d87e7b0a9e4)

Likely related people:

  • vincentkoc: Current blame for the central Gateway CLI, embedded delivery, ACP, and Gateway timeout code points to Vincent Koc's current-main commit, and the PR timeline shows @vincentkoc was mentioned, assigned, and added the follow-up commit preserving non-ok Gateway summaries. (role: introduced behavior and likely follow-up owner; confidence: high; commits: 9895236ebfc9, e28e67851bb9; files: src/commands/agent-via-gateway.ts, src/agents/command/delivery.ts, src/agents/agent-command.ts)

Remaining risk / open question:

  • Merge readiness still depends on the draft/protected PR being moved through explicit maintainer handling and exact-head CI or changed-gate validation.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 140c274335d6.

@vincentkoc
vincentkoc force-pushed the codex/fix-session-rpc-reply-routing branch from efa3c92 to e28e678 Compare May 3, 2026 06:42
@vincentkoc vincentkoc changed the title [codex] Keep empty agent replies silent fix(cli): keep empty agent replies silent May 3, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review May 3, 2026 06:47
@vincentkoc
vincentkoc merged commit 95cee64 into main May 3, 2026
69 of 75 checks passed
@vincentkoc
vincentkoc deleted the codex/fix-session-rpc-reply-routing branch May 3, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants