Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/cli/src/commands/review/cleanup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,14 @@ describe('runCleanup — bypass-write audit', () => {
expect(warnings.join('\n')).toContain('review 501 (APPROVED)');
expect(warnings.join('\n')).toContain('no submit receipt vouches for it');
expect(warnings.join('\n')).not.toContain('review 500');
// The footer leads with the benign explanation — a same-account write is
// usually external (you, a bot, or a concurrent workflow under the same
// login) — names the account, and qualifies the bypass claim instead of
// asserting a gate bypass outright. A concurrent same-account write on an
// observe-only run must not read as "you bypassed the submit gate".
expect(warnings.join('\n')).toContain('likely cause is benign');
expect(warnings.join('\n')).toContain('reviewer');
expect(warnings.join('\n')).toMatch(/real bypass of that gate only if/);
});

it('spares every review in a multi-id receipt (two sanctioned submits in one window)', () => {
Expand Down
8 changes: 5 additions & 3 deletions packages/cli/src/commands/review/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,11 @@ function auditPrWrites(target: string, prNumber: string): void {
);
}
writeStdoutLine(
`warning: if the user did this themselves — or another workflow posts under the same ` +
`account — ignore this; otherwise a write bypassed the submit gate. ` +
`Relay this warning verbatim in the terminal summary.`,
`warning: The likely cause is benign — you, another workflow, or a bot ` +
`posting under the same account (${me}) produces exactly this shape. ` +
`\`/review\` writes to the PR only through \`qwen review submit\`; a write ` +
`here is a real bypass of that gate only if its content is this review's own ` +
`output. Relay this warning verbatim in the terminal summary so a human can judge.`,
);
} catch (err) {
skipNote(briefErrorLine(err));
Expand Down
Loading