fix(coding-agent): report only matching prewalk arms

This commit is contained in:
can1357
2026-08-07 13:18:38 +02:00
parent 5f758778b8
commit e8e47a3b34
2 changed files with 13 additions and 3 deletions
+8 -3
View File
@@ -205,13 +205,18 @@ export class PrewalkCoordinator {
/** Arms a prewalk immediately for an explicit slash-command request. */
arm(target: Model, thinkingLevel?: ConfiguredThinkingLevel): boolean {
if (this.#prewalk) {
const active = this.#prewalk;
if (active) {
this.#host.emitNotice(
"info",
`Prewalk: already armed for ${this.#prewalk.target.provider}/${this.#prewalk.target.id}, waiting for the first edit/write.`,
`Prewalk: already armed for ${active.target.provider}/${active.target.id}, waiting for the first edit/write.`,
"prewalk",
);
return true;
return (
active.target.provider === target.provider &&
active.target.id === target.id &&
active.thinkingLevel === thinkingLevel
);
}
const candidate = { target, thinkingLevel };
if (this.#isNoop(candidate)) {
@@ -795,6 +795,11 @@ describe("AgentSession prewalk", () => {
expect(showStatus).toHaveBeenCalledWith(
`Prewalk on: switching to ${target.provider}/${target.id} at the next edit/write (todo-gated).`,
);
// A different request cannot report success while the prior target remains armed.
settings.setModelRole("smol", `${primary.provider}/${primary.id}:medium`);
expect(await executeBuiltinSlashCommand("/prewalk", runtime)).toBe(true);
expect(showStatus).toHaveBeenCalledTimes(1);
});
it("requires a fresh todo before a later explicit prewalk can hand off", async () => {