Skip to content

fix(agents): neutralize Anthropic refusal marker replacement - #136935

Merged
RomneyDa merged 1 commit into
extended-stable/2026.6.33from
fix/extended-stable-2026-6-35-anthropic-refusal-redaction
Sep 7, 2026
Merged

RomneyDa merged 1 commit into
extended-stable/2026.6.33from
fix/extended-stable-2026-6-35-anthropic-refusal-redaction

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Sep 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Backport the already-landed main repair from #132556 to the 2026.6.35 extended-stable candidate.

The frozen runtime scrubbed the Anthropic refusal sentinel into English text that still described a refusal trigger. Claude Haiku then refused that synthetic live probe. The replacement is now the neutral string [redacted], while repeated markers and surrounding nonce text remain intact.

Failure proof

Verification

  • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/helpers.test.ts — 14 passed.
  • pnpm exec vitest run --config test/vitest/vitest.live.config.ts src/gateway/gateway-models.profiles.live.test.ts — 109 passed, 2 skipped; no provider calls.
  • Focused Oxfmt and type-aware OXLint passed.
  • git diff --check passed.
  • Autoreview local mode: clean, no actionable findings; correctness 0.99.

Production delta: 2 additions / 2 removals, net 0. Tests: 24 additions / 2 removals. No config, dependency, protocol, tag, package, or npm-selector changes.

Current merge gate

The recorded preflight/security-fast failures are from the frozen-checkout authentication defect tracked by #136949 and occur before this patch is exercised. Rerun this unchanged head after #136949 lands; no code failure is currently attributed to this PR.

@RomneyDa

RomneyDa commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Sep 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 3:55 PM ET / 19:55 UTC.

ClawSweeper review

What this changes

Replaces the Anthropic refusal-marker placeholder with neutral text on extended-stable and updates sanitization and transcript-correlation tests.

Merge readiness

✅ Ready for maintainer review

No blocking findings. This remains a useful extended-stable backport despite the fix already existing on main. The previous preflight/security-fast blocker is resolved in the supplied current-head checks.

Priority: P2
Reviewed head: f9197ee751bcb7de82694a8400783751aafd6f00

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused backport with useful regression coverage, no blocking findings, and the previous validation blocker resolved.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored backport is exempt from the external-contributor proof gate. Its body reports the frozen Haiku failure and focused tests; the linked original repair reports after-fix Gateway success, which is supporting context rather than a fresh run of this head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored backport is exempt from the external-contributor proof gate. Its body reports the frozen Haiku failure and focused tests; the linked original repair reports after-fix Gateway success, which is supporting context rather than a fresh run of this head.
Evidence reviewed 7 items Introduced change and runtime boundary: The pinned delta changes only the replacement text and its tests. The helper still replaces every exact marker occurrence; run.ts:1932 retains the Anthropic-only guard and passes the prepared prompt to runEmbeddedAttemptWithBackend. No authorization, retry, provider-selection, or history-rewrite policy changes.
Regression coverage and live-probe contract: Helper cases cover repeated markers, preserved surrounding text and unchanged ordinary prompts. Gateway correlation retains the random nonce and rejects a different nonce. The real probe requests 'ok' followed by 'still ok'; its assertions and request behavior are unchanged.
Current main already uses the neutral replacement: Fetched main uses '[redacted]' through its Anthropic-only prompt preparation helper. The supplied GitHub context identifies #132556 as the merged original repair, with reported Linux Gateway before/after proof. This PR targets extended-stable/2026.6.33, whose pinned base still uses the descriptive placeholder.
Findings None None.
Security None None.

How this fits together

The embedded agent runner prepares user prompts before dispatching them to a model. Its Anthropic-specific sanitizer removes a known refusal-test marker, while Gateway probes use preserved nonce suffixes to identify the resulting conversation turn.

flowchart TD
  A[User prompt] --> B[Provider selection]
  B -->|Anthropic| C[Replace exact refusal marker]
  B -->|Other providers| D[Preserve prompt]
  C --> E[Agent attempt]
  D --> E
  E --> F[Model response and transcript]
  F --> G[Gateway probe correlation]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +22. Total +22 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 2 24 2 +22
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 26 4 +22

Review metrics

None.

Root-cause cluster

Relationship: same_root_cause
Canonical: #132556
Summary: The merged main repair and this extended-stable backport address the same placeholder-induced refusal; the CI repair is a separate dependency.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Carry the established neutral replacement into extended-stable while preserving its existing provider guard, exact-marker scope, and nonce correlation.

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

No current-main failure was reproduced: main already contains the repair. The supplied release failure and inspected extended-stable sanitizer establish the backport's concrete trigger.

Is this the best way to solve the issue?

Yes. Changing the existing sanitizer's placeholder matches the merged main repair and avoids adding retry, fallback, or competing sanitization paths.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against bdf5d9939abf.

Labels

Label justifications:

  • P2: This is a bounded extended-stable repair for spurious Anthropic refusals triggered by the existing sanitizer's placeholder.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored backport is exempt from the external-contributor proof gate. Its body reports the frozen Haiku failure and focused tests; the linked original repair reports after-fix Gateway success, which is supporting context rather than a fresh run of this head.

Evidence

What I checked:

  • Introduced change and runtime boundary: The pinned delta changes only the replacement text and its tests. The helper still replaces every exact marker occurrence; run.ts:1932 retains the Anthropic-only guard and passes the prepared prompt to runEmbeddedAttemptWithBackend. No authorization, retry, provider-selection, or history-rewrite policy changes. (src/agents/embedded-agent-runner/run/helpers.ts:88, f9197ee751bc)
  • Regression coverage and live-probe contract: Helper cases cover repeated markers, preserved surrounding text and unchanged ordinary prompts. Gateway correlation retains the random nonce and rejects a different nonce. The real probe requests 'ok' followed by 'still ok'; its assertions and request behavior are unchanged. (src/gateway/gateway-models.profiles.live.test.ts:2447, f9197ee751bc)
  • Current main already uses the neutral replacement: Fetched main uses '[redacted]' through its Anthropic-only prompt preparation helper. The supplied GitHub context identifies fix(agents): neutralize Anthropic refusal marker replacement #132556 as the merged original repair, with reported Linux Gateway before/after proof. This PR targets extended-stable/2026.6.33, whose pinned base still uses the descriptive placeholder. (src/agents/embedded-agent-runner/run/helpers.ts:81, bdf5d9939abf)
  • Original repair history and release containment: Local commit metadata identifies the merged neutral-placeholder repair dated 2026-08-29T09:25:48-07:00. A separate git tag --contains check listed v2026.9.2, establishing inclusion in the latest release without establishing the first shipped release. (72491232aa28)
  • Previous review follow-up satisfied: The prior review requested rerunning preflight and security-fast after the frozen-checkout authentication repair. Supplied GitHub evidence shows fix(ci): authenticate frozen source checkouts #136949 merged as this head's base, and both checks now succeeded. Other supplied checks remain in progress; that is routine CI state. (f9197ee751bc)
  • Anthropic dependency contract: The PR's model-generated refusal claim establishes the relevant dependency signal. Official Anthropic documentation distinguishes standard-text model refusals from classifier refusal stop reasons: https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/handle-streaming-refusals. This supports the reported mechanism; the documentation does not guarantee any particular replacement will always receive compliance. No changed behavior depends on a Codex contract.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-03T03:50:22.925Z sha 0374625 :: blocked before merge. :: none
  • reviewed 2026-09-03T23:53:11.421Z sha 0374625 :: blocked before merge. :: none

@RomneyDa

RomneyDa commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review exact current head; please confirm only current actionable findings and rank-up moves.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@RomneyDa
RomneyDa force-pushed the fix/extended-stable-2026-6-35-anthropic-refusal-redaction branch from 0374625 to f9197ee Compare September 7, 2026 19:50
@RomneyDa
RomneyDa merged commit 35af49e into extended-stable/2026.6.33 Sep 7, 2026
93 checks passed
@RomneyDa
RomneyDa deleted the fix/extended-stable-2026-6-35-anthropic-refusal-redaction branch September 7, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant