Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions docs/content/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ your user permissions, and approval stays with you.
Pull requests, remote branches, and exact local ranges use `snapshot-only`
access because their target may not match the live checkout. The agent gets the
temporary review input and must use only that input; it must not run commands
or read other files. Diffsplain prints one warning when a selected agent uses
this mode because of a target mismatch.
or read other files.

Pass `--no-checkout-access` to use `snapshot-only` access for any target. This
option affects agent notes only. It does not change the diff or the page.
Expand Down
10 changes: 0 additions & 10 deletions scripts/generate-summaries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ const booleanFlags = new Set([
'--support-record',
'--worktree',
'--no-checkout-access',
'--access-warning-emitted',
'--provider-read-only-warning-emitted',
]);

Expand Down Expand Up @@ -348,15 +347,6 @@ try {
emitFailedSupportRecord(2);
process.exit(2);
}
if (
accessMode.mode === 'snapshot-only' &&
accessMode.reason === 'target-mismatch' &&
!rawArgs.includes('--access-warning-emitted')
) {
console.log(
'Warning: This target does not map to the live checkout. Agent notes will use the supplied snapshot only.',
);
}
const readOnlyWarning = agentReadOnlyWarning(selectedAgent, accessMode);
if (
readOnlyWarning &&
Expand Down
9 changes: 0 additions & 9 deletions scripts/present.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,6 @@ if (agentEnabled) {
performance.now() - selectionStarted,
);
agentArgs.push('--agent', selectedAgent);
if (
accessMode.mode === 'snapshot-only' &&
accessMode.reason === 'target-mismatch'
) {
console.log(
'Warning: This target does not map to the live checkout. Agent notes will use the supplied snapshot only.',
);
agentArgs.push('--access-warning-emitted');
}
const readOnlyWarning = agentReadOnlyWarning(selectedAgent, accessMode);
if (readOnlyWarning) {
console.log(readOnlyWarning);
Expand Down
6 changes: 2 additions & 4 deletions tests/generate-summaries.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1866,13 +1866,11 @@ test("keeps disabled checkout access in the temporary snapshot context", async (
}
});

test("warns once and keeps a mismatched range in the snapshot context", async () => {
test("keeps a mismatched range in the snapshot context without warning", async () => {
const repo = await makeRepo();
const directory = await mkdtemp(join(tmpdir(), "diffsplain-agent-access-"));
const summaries = join(repo, "notes.json");
const output = join(repo, "diff-data.json");
const warning = "Warning: This target does not map to the live checkout. Agent notes will use the supplied snapshot only.";

try {
const codex = await accessRecordingCodex(directory, repo);
const result = run(
Expand All @@ -1893,7 +1891,7 @@ test("warns once and keeps a mismatched range in the snapshot context", async ()
);

assert.equal(result.status, 0, result.stderr);
assert.equal(result.stdout.split(warning).length - 1, 1);
assert.doesNotMatch(result.stdout, /does not map to the live checkout/);
const calls = await recordedCalls(codex.calls);
assert.ok(calls.length >= 2);
for (const call of calls) {
Expand Down
5 changes: 2 additions & 3 deletions tests/present-agent.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ test("starts the note agent after the watch snapshot and stops cleanly", async (
}
});

test("warns once and passes snapshot-only access to a mismatched range", async () => {
test("passes snapshot-only access to a mismatched range without warning", async () => {
const root = await mkdtemp(join(tmpdir(), "diffsplain-present-access-"));
const repo = join(root, "repo");
const bin = join(root, "bin");
Expand Down Expand Up @@ -481,8 +481,7 @@ test("warns once and passes snapshot-only access to a mismatched range", async (
return value.notes?.complete ? value : undefined;
});

const warning = "Warning: This target does not map to the live checkout. Agent notes will use the supplied snapshot only.";
assert.equal(outputText().split(warning).length - 1, 1);
assert.doesNotMatch(outputText(), /does not map to the live checkout/);
assert.equal(snapshot.notes.accessMode, "snapshot-only");
const agentCalls = (await readFile(calls, "utf8"))
.trim()
Expand Down
Loading