You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(devin): rewrite the Claude Code sentences Cognition refuses (#8558) - #8703
Claude Code's system prompt contains three whole sentences that Cognition's content filter rejects with permission_denied. Every Claude Code turn routed to a Devin model therefore failed, while Codex worked on the same account. This adds those three sentences to COGNITION_BLOCKLIST_REWRITES as meaning-preserving rewrites.
Rebased onto dev after #8590 merged, as requested: the three entries follow the two Codex boilerplate entries, the comment paragraph is position-independent, #8590's Scope note is untouched, and the test file keeps its single streamChatEvents, type ChatHistoryItem import.
What changed
src/adapters/devin/cloud-direct/chat.ts: three new entries appended to COGNITION_BLOCKLIST_REWRITES, matched like the existing Codex entries (case-insensitive, flexible whitespace, optional commas). The rewrites keep the original authorization/safety meaning:
…Claude Agent SDK → …Claude Agent Toolkit
Dual-use security tools … require clear authorization context: … → Dual-purpose security tools … need clear authorization context: … (the authorization requirement and its list of contexts are unchanged)
Claude Code is available as a CLI … → Claude Code ships as a CLI …
bun run typecheck (bun check --no-script --noEmit) → no type errors in 2,533 files.
Full suite not run locally — a local tests/providers run in one process shows pre-existing cross-file interference between the Kiro and Devin files (reproduces with this patch reverted), so CI is the authority for the whole tree.
What the wire-level tests assert:
buildGetChatMessageRequest with all three sentences in the leading system prompt and verbatim in user text, replayed assistant history/thinking, tool-call arguments and a tool result:
every field [codex] Refresh Codex cache after provider changes #3 message body is byte-identical to a control request encoded without the system prompt (only the per-request random message id is normalized), so message content, history, thinking, tool-call arguments and tool results are unchanged under the default policy;
the literal sentences still appear verbatim in those data fields.
Tool definitions: a description containing a sentence is rewritten, while the same bytes in tool-call arguments stay literal.
Table-level: the three originals plus lowercase / missing-comma / doubled-space variants are rewritten; benign sub-phrases (Claude Agent SDK, credential testing, VS Code, JetBrains, Claude Code is available) are left alone.
Evidence
Live observation on a Devin account, disclosed in #8558: each of the three original sentences alone returned 403 permission_denied against swe-2-flash, while the rewritten sentences (alone and combined in one prompt) returned 200; the same account served Codex turns normally. Lowercasing, dropping a comma, or doubling a space was still refused, which is why these entries match flexibly like the Codex ones.
Review readiness checklist
Required local validation passed; commands, results, and any full-suite exception are documented. (Targeted test file + typecheck; the full suite was not run locally — CI is the authority.)
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
Bug Fixes
Improved handling of selected Claude Code system-prompt wording when communicating through the Devin adapter, including variations in capitalization, spacing, and punctuation.
Rewrites are limited to matching system-instruction and tool-description text; conversation history, tool inputs, and tool results remain unchanged.
No actionable comments were generated in the recent review.
Walkthrough
The Devin adapter adds three rewrites for Claude Code sentences that trigger Cognition’s blocklist. Tests cover case and whitespace variants, preservation of surrounding text, and the scope of changes to outgoing request fields.
Changes: Devin Claude Code prompt rewrites
Layer / File(s)
Summary
Add and verify blocklist rewrites src/adapters/devin/cloud-direct/chat.ts, tests/providers/devin-adapter.test.ts
The adapter documents three Claude Code sentences and adds case-insensitive rewrites with flexible whitespace and optional commas. Sanitizer tests cover sentence variants, surrounding text, and selected benign phrases.
Verify rewrites in outgoing requests tests/providers/devin-adapter.test.ts
Wire-level tests verify rewritten system-instruction and tool-description fields. They also verify that message bodies, thinking, tool-call arguments, and tool results remain unchanged.
This change rewrites three Claude Code prompt sentences that Cognition refuses, so Claude Code requests routed to Devin should no longer be rejected. The rewrites apply only to instruction surfaces, and tests check that message bodies and tool-call arguments are unchanged. No merge-blocking risk is evident.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the primary change: rewriting three Claude Code system-prompt sentences that Cognition refuses, in the Devin adapter. The raw summary and objectives confirm that COGNITION_BLOCKLIST_RE…
Linked Issues check
[#8558] Required: add meaning-preserving rewrites for the three Claude Code system-prompt sentences in COGNITION_BLOCKLIST_REWRITES, use flexible matching (case, whitespace, optional commas), and add …
Out of Scope Changes check
The whole-PR diff against merge base 1d10758 changes two files. chat.ts adds a 10-line comment block that cites #8558 and three entries to COGNITION_BLOCKLIST_REWRITES. The existing entries, including…
Full details: Title check
Explanation
The title names the primary change: rewriting three Claude Code system-prompt sentences that Cognition refuses, in the Devin adapter. The raw summary and objectives confirm that COGNITION_BLOCKLIST_REWRITES gains three case-insensitive, whitespace-tolerant rewrites with regression tests. The title's '(#8558)' is the linked issue number, which is acceptable context. Title is specific and matches the changeset.
Full details: Linked Issues check
Explanation
[#8558] Required: add meaning-preserving rewrites for the three Claude Code system-prompt sentences in COGNITION_BLOCKLIST_REWRITES, use flexible matching (case, whitespace, optional commas), and add regression tests. Whole-PR diff against merge base 1d10758 shows all three requirements in src/adapters/devin/cloud-direct/chat.ts: (1) 'You are a Claude agent, built on Anthropic's Claude Agent SDK' maps to '...Claude Agent Toolkit'; (2) the Dual-use security tools sentence maps to 'Dual-purpose ... need clear authorization context: ...' with the same contexts list; (3) 'Claude Code is available as a CLI ...' maps to 'Claude Code ships as a CLI ...'. Each regex uses the i flag, \s+ between words, and ,? for the optional commas, matching the issue's suggested patterns. Tests in tests/providers/devin-adapter.test.ts (+167 lines) cover table-level rewrites, lowercase/missing-comma/double-space variants, sub-phrase passthrough, wire-level encoding (field #2 rewritten, #3 bodies byte-identical to a control request), and tool descriptions versus tool arguments. The issue named tests/devin-adapter.test.ts; the suite lives at tests/providers/devin-adapter.test.ts, which is an acceptable location. The live 403/200 probe results are author-reported and were not re-run. The test run and typecheck results are author-reported and were not re-run. The issue's coding requirements are met at the code level.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against merge base 1d10758 changes two files. chat.ts adds a 10-line comment block that cites #8558 and three entries to COGNITION_BLOCKLIST_REWRITES. The existing entries, including the case-sensitive TaskOutput entry, are unchanged in the hunks shown. The test file adds three #8558 tests and no unrelated changes. Each change connects directly to #8558's requested rewrites and regression tests. No unrelated refactoring or cleanup was found.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between e991b77 and 378118c.
Files selected for processing: 2
src/adapters/devin/cloud-direct/chat.ts
tests/providers/devin-adapter.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Merge-manager note: #8590 just merged (4cbe4be) and touches the same COGNITION_BLOCKLIST_REWRITES table, comment block, import line and test insertion point, so this branch now conflicts. Please merge dev, append your three entries after #8590's two, reword the comment to "The three #8558 entries (Claude Code system prompt)…" so it doesn't depend on position, keep #8590's Scope note, and import streamChatEvents, type ChatHistoryItem once. The change itself reviewed clean (non-overlapping patterns, byte-identical data bodies, real-encoder tests). Then tick the readiness boxes on that head.
…e-jun#8558)
Claude Code's system prompt carries three whole sentences that Cognition's
content filter refuses with permission_denied, so every Claude Code turn to a
Devin model failed while Codex worked on the same account. Each sentence was
refused alone and on lowercase/whitespace/comma variants, so they are matched
like the Codex entries and reworded without losing their
authorization/safety meaning.
The regression tests build requests through buildGetChatMessageRequest, assert
the lidge-jun#2 system prompt is rewritten end to end, and assert every lidge-jun#3 message body
(user text, history, thinking, tool-call arguments, tool results) is
byte-identical to a control encoded without the system prompt. Existing table
entries and their case sensitivity are unchanged.
Rebased onto dev after lidge-jun#8590 merged: the three entries follow the two Codex
boilerplate entries, the comment no longer depends on table position, lidge-jun#8590's
Scope note is untouched, and the test file keeps its single
`streamChatEvents, type ChatHistoryItem` import.
Co-Authored-By: Claude Code <noreply@anthropic.com>
…nclude, Command Code root schemas, JEV continuation effort (#8873)
Lane R3 of the 2026-11-17 triage round: rewrite the Claude Code sentences Cognition refuses for Devin (#8703), normalize the OpenCode Go output include (#8827), normalize root tool schemas for Command Code's Claude upstreams (#8591), and keep JEV's decided effort through tool-loop continuations (#8861, continuation fix only), with review follow-ups.
Co-authored-by: 袁威豪 <137183806+jhl880617@users.noreply.github.com>
Co-authored-by: Ingwannu <186453546+Ingwannu@users.noreply.github.com>
Co-authored-by: Mursyid <ciddhere@gmail.com>
Co-authored-by: tachyon6 <songjunjun62754@gmail.com>
Thank you. This change was carried, with your authorship kept as a Co-authored-by trailer, in #8873, which is now merged into dev as 2590e2e (2026-11-17 triage round). Closing as superseded; see #8873 for the review follow-ups made on top.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Claude Code's system prompt contains three whole sentences that Cognition's content filter rejects with
permission_denied. Every Claude Code turn routed to a Devin model therefore failed, while Codex worked on the same account. This adds those three sentences toCOGNITION_BLOCKLIST_REWRITESas meaning-preserving rewrites.Closes #8558.
Rebased onto
devafter #8590 merged, as requested: the three entries follow the two Codex boilerplate entries, the comment paragraph is position-independent, #8590's Scope note is untouched, and the test file keeps its singlestreamChatEvents, type ChatHistoryItemimport.What changed
src/adapters/devin/cloud-direct/chat.ts: three new entries appended toCOGNITION_BLOCKLIST_REWRITES, matched like the existing Codex entries (case-insensitive, flexible whitespace, optional commas). The rewrites keep the original authorization/safety meaning:…Claude Agent SDK→…Claude Agent ToolkitDual-use security tools … require clear authorization context: …→Dual-purpose security tools … need clear authorization context: …(the authorization requirement and its list of contexts are unchanged)Claude Code is available as a CLI …→Claude Code ships as a CLI …Takes a task_id…one, and fix(devin): handle denied Codex boilerplate and optional history rewrites #8590's data-surface opt-in are unchanged.tests/providers/devin-adapter.test.ts: three regression tests through the real request encoder, not only the regex table.Verification
bun run test tests/providers/devin-adapter.test.ts→ 58 pass, 0 fail (424 expect() calls). The 58 includes fix(devin): handle denied Codex boilerplate and optional history rewrites #8590's tests; the three added here are the#8558ones.bun run typecheck(bun check --no-script --noEmit) → no type errors in 2,533 files.tests/providersrun in one process shows pre-existing cross-file interference between the Kiro and Devin files (reproduces with this patch reverted), so CI is the authority for the whole tree.What the wire-level tests assert:
buildGetChatMessageRequestwith all three sentences in the leading system prompt and verbatim in user text, replayed assistant history/thinking, tool-call arguments and a tool result:Claude Agent SDK,credential testing,VS Code, JetBrains,Claude Code is available) are left alone.Evidence
Live observation on a Devin account, disclosed in #8558: each of the three original sentences alone returned
403 permission_deniedagainstswe-2-flash, while the rewritten sentences (alone and combined in one prompt) returned200; the same account served Codex turns normally. Lowercasing, dropping a comma, or doubling a space was still refused, which is why these entries match flexibly like the Codex ones.Review readiness checklist
dev@1d10758, after fix(devin): handle denied Codex boilerplate and optional history rewrites #8590 merged as4cbe4be.)🤖 Generated with Claude Code
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit