Skip to content

fix: Align silent reply prompt guidance - #70954

Merged
Takhoffman merged 10 commits into
mainfrom
codex/remove-silent-reply-rewrite
Apr 24, 2026
Merged

Takhoffman merged 10 commits into
mainfrom
codex/remove-silent-reply-rewrite

Conversation

@Takhoffman

Copy link
Copy Markdown
Contributor

Summary

  • add direct-chat system guidance so the model knows when NO_REPLY routes through silence, rewrite, or is disallowed
  • gate group always-on NO_REPLY guidance on the resolved silentReply + silentReplyRewrite settings
  • pass the known chat type into prompt-side silent reply resolution so generic session keys do not fall back to internal policy
  • keep the existing deterministic silentReplyRewrite fallback behavior and config surface intact

What changed conceptually

The conversation type still tells the model where it is, but the silent-reply settings now tell the prompt whether NO_REPLY is valid there:

allow -> NO_REPLY stays silent
disallow + rewrite=true -> NO_REPLY lets OpenClaw send the configured fallback
disallow + rewrite=false -> prompt tells the model not to use NO_REPLY

Validation

  • pnpm test src/shared/silent-reply-policy.test.ts src/infra/outbound/payloads.test.ts src/infra/outbound/deliver.test.ts src/auto-reply/reply/groups.test.ts src/agents/prompt-composition.test.ts
  • pnpm test src/shared/silent-reply-policy.test.ts src/config/silent-reply.test.ts src/infra/outbound/payloads.test.ts src/infra/outbound/deliver.test.ts src/auto-reply/reply/groups.test.ts src/agents/prompt-composition.test.ts src/auto-reply/reply/reply-flow.test.ts src/auto-reply/reply/route-reply.test.ts
  • pnpm config:schema:check && pnpm config:docs:check
  • pnpm exec oxfmt --check on touched files

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Apr 24, 2026
@greptile-apps

greptile-apps Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR wires silentReplyPolicy and silentReplyRewrite through the prompt-composition layer so the model is informed whether NO_REPLY routes to silence, a fallback rewrite, or is disallowed — addressing the previous "dm" ChatType gap and adding direct-chat system-prompt guidance. The logic in buildGroupIntro, buildDirectChatContext, reply-dispatcher, and the outbound session context is correct and well-tested. Two minor points remain:

  • reply.triggers.group-intro-prompts.cases.ts was not updated to pass the new policy params to buildGroupIntro; the "whatsapp-always-on" test case now silently generates the wrong silence line and is missing a caution-line assertion.
  • resolveSilentFinalPayload in reply-dispatcher.ts declares | null in its return type but never returns null; a future null return would fall through the ?? guard and trigger normalization instead of being treated as a resolved silent payload.

Confidence Score: 4/5

Safe to merge; production behavior is correct, but the test coverage gap in the always-on group scenario should be addressed.

All P0/P1 concerns from the previous review are addressed. The two remaining findings are P2: one is a test-fixture inconsistency that doesn't affect runtime, and the other is an overly wide return type annotation with no current runtime impact. Score is 4 rather than 5 because the reply.triggers.group-intro-prompts.cases.ts gap is a genuine coverage miss that could mask a future regression in the always-on group silence-line guidance.

src/auto-reply/reply.triggers.group-intro-prompts.cases.ts (missing silentReplyPolicy in buildGroupIntro call, no assertion on silence-line text for always-on activation) and src/auto-reply/reply/reply-dispatcher.ts (overly wide | null return type on resolveSilentFinalPayload).

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/auto-reply/reply.triggers.group-intro-prompts.cases.ts
Line: 106-111

Comment:
**Silence-line guidance silently diverges from production in the "always-on" case**

`buildGroupIntro` is now called without `silentReplyPolicy`, so `canUseSilentReply` falls back to `true` (because `undefined !== "disallow"`) and the generated `silenceLine` says "so OpenClaw can send a short fallback reply" instead of "so OpenClaw stays silent" — which is what the resolved `"allow"` group default would produce at runtime. The `cautionLine` ("Be extremely selective…") is also absent because `undefined === "allow"` is `false`. The test expectations for the "whatsapp-always-on" case don't assert on either of these two strings, so the gap goes undetected. Passing `silentReplyPolicy` and `silentReplyRewrite` (resolved from the test cfg, or at least the group defaults) and adding assertions for the silence-line text and caution-line would close the coverage gap.

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/reply-dispatcher.ts
Line: 118-173

Comment:
**Return type advertises `null` but the function never returns it**

`resolveSilentFinalPayload` is typed as `ReplyPayload | null | undefined`, yet every branch returns `undefined` or a `ReplyPayload` — `null` is never produced. At the call site the result is consumed with `silentFinalPayload ??`, so a `null` return would fall through to `normalizeReplyPayloadInternal` rather than being treated as a resolved silent payload — silently wrong behaviour if `null` is ever introduced by a future branch. Narrowing the return type to `ReplyPayload | undefined` would prevent this latent trap.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (3): Last reviewed commit: "Rewrite direct silent replies in dispatc..." | Re-trigger Greptile

Comment thread src/auto-reply/reply/get-reply-run.ts Resolved
@Takhoffman
Takhoffman marked this pull request as draft April 24, 2026 05:44
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Apr 24, 2026
@Takhoffman

Copy link
Copy Markdown
Contributor Author

Follow-up on automated review notes:

  • Greptile inline dm alias comment is fixed in 48b1f54cf5 and replied inline.
  • Aisle note about external chat type falling back to internal is addressed by 39a3c71f94: prompt resolution passes explicit inbound chat type, outbound session context now carries conversationType, and delivery passes it into payload planning.
  • Aisle note about literal NO_REPLY when silentReplyRewrite.direct=false describes the intentional opt-out behavior of the existing config knob; the default remains rewrite-enabled for direct conversations.

@Takhoffman
Takhoffman marked this pull request as ready for review April 24, 2026 13:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48b1f54cf5

ℹ️ 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".

Comment thread src/auto-reply/reply/route-reply.ts Resolved
@Takhoffman

Copy link
Copy Markdown
Contributor Author

@codex review

@Takhoffman Takhoffman changed the title Align silent reply prompt guidance fix: Align silent reply prompt guidance Apr 24, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 63e0cf2585

ℹ️ 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".

Comment thread src/auto-reply/reply/get-reply-run.ts Resolved
@Takhoffman

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eacf4fe96f

ℹ️ 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".

Comment thread src/auto-reply/reply/get-reply-run.ts Resolved
@Takhoffman
Takhoffman marked this pull request as draft April 24, 2026 14:21
@Takhoffman

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34f70ed136

ℹ️ 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".

Comment thread src/auto-reply/reply/get-reply-run.ts Resolved
@Takhoffman

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93d3b9186b

ℹ️ 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".

Comment thread src/auto-reply/reply/groups.ts Resolved
@Takhoffman

Copy link
Copy Markdown
Contributor Author

@codex review and find them all

@Takhoffman

Copy link
Copy Markdown
Contributor Author

@codex please find every issue that you're going to report. I would like to finish this review while I am still biologically alive.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e4940bf80

ℹ️ 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".

Comment thread src/auto-reply/reply/get-reply-run.ts Resolved
@Takhoffman

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1e0033a4f

ℹ️ 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".

Comment thread src/auto-reply/reply/groups.ts Resolved
@Takhoffman

Copy link
Copy Markdown
Contributor Author

@codex k

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

To use Codex here, create an environment for this repo.

@Takhoffman
Takhoffman marked this pull request as ready for review April 24, 2026 17:06
@Takhoffman
Takhoffman merged commit cc57d56 into main Apr 24, 2026
40 checks passed
@Takhoffman
Takhoffman deleted the codex/remove-silent-reply-rewrite branch April 24, 2026 17:06
Angfr95 pushed a commit to Angfr95/openclaw that referenced this pull request Apr 25, 2026
* Align silent reply prompt guidance

* Pass explicit silent reply conversation types

* Handle dm alias in direct prompt guidance

* Respect policy session type for routed replies

* Preserve routed silent reply policy type

* Propagate silent reply dispatcher chat type

* Align prompt silent reply target policy

* Avoid direct silent fallback prompt token

* Use inbound key for prompt silent policy

* Rewrite direct silent replies in dispatcher
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* Align silent reply prompt guidance

* Pass explicit silent reply conversation types

* Handle dm alias in direct prompt guidance

* Respect policy session type for routed replies

* Preserve routed silent reply policy type

* Propagate silent reply dispatcher chat type

* Align prompt silent reply target policy

* Avoid direct silent fallback prompt token

* Use inbound key for prompt silent policy

* Rewrite direct silent replies in dispatcher
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
* Align silent reply prompt guidance

* Pass explicit silent reply conversation types

* Handle dm alias in direct prompt guidance

* Respect policy session type for routed replies

* Preserve routed silent reply policy type

* Propagate silent reply dispatcher chat type

* Align prompt silent reply target policy

* Avoid direct silent fallback prompt token

* Use inbound key for prompt silent policy

* Rewrite direct silent replies in dispatcher
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* Align silent reply prompt guidance

* Pass explicit silent reply conversation types

* Handle dm alias in direct prompt guidance

* Respect policy session type for routed replies

* Preserve routed silent reply policy type

* Propagate silent reply dispatcher chat type

* Align prompt silent reply target policy

* Avoid direct silent fallback prompt token

* Use inbound key for prompt silent policy

* Rewrite direct silent replies in dispatcher
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* Align silent reply prompt guidance

* Pass explicit silent reply conversation types

* Handle dm alias in direct prompt guidance

* Respect policy session type for routed replies

* Preserve routed silent reply policy type

* Propagate silent reply dispatcher chat type

* Align prompt silent reply target policy

* Avoid direct silent fallback prompt token

* Use inbound key for prompt silent policy

* Rewrite direct silent replies in dispatcher
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* Align silent reply prompt guidance

* Pass explicit silent reply conversation types

* Handle dm alias in direct prompt guidance

* Respect policy session type for routed replies

* Preserve routed silent reply policy type

* Propagate silent reply dispatcher chat type

* Align prompt silent reply target policy

* Avoid direct silent fallback prompt token

* Use inbound key for prompt silent policy

* Rewrite direct silent replies in dispatcher
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
* Align silent reply prompt guidance

* Pass explicit silent reply conversation types

* Handle dm alias in direct prompt guidance

* Respect policy session type for routed replies

* Preserve routed silent reply policy type

* Propagate silent reply dispatcher chat type

* Align prompt silent reply target policy

* Avoid direct silent fallback prompt token

* Use inbound key for prompt silent policy

* Rewrite direct silent replies in dispatcher
Heetisk pushed a commit to Heetisk/openclaw that referenced this pull request Sep 28, 2026
* Align silent reply prompt guidance

* Pass explicit silent reply conversation types

* Handle dm alias in direct prompt guidance

* Respect policy session type for routed replies

* Preserve routed silent reply policy type

* Propagate silent reply dispatcher chat type

* Align prompt silent reply target policy

* Avoid direct silent fallback prompt token

* Use inbound key for prompt silent policy

* Rewrite direct silent replies in dispatcher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant