fix(coding-agent): report only matching prewalk arms
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user