fix(coding-agent): aligned task prewalk dashboard state
Shared the bundled task prewalk default between runtime execution and the Agent Control Center. Added dashboard regression coverage for task.prewalk. Fixes #6306
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed `/agents` showing prewalk as off for the bundled `task` agent when `task.prewalk` enables its runtime default ([#6306](https://github.com/can1357/oh-my-pi/issues/6306)).
|
||||
|
||||
## [17.0.7] - 2026-07-21
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -49,6 +49,7 @@ import agentCreationArchitectPrompt from "../../prompts/system/agent-creation-ar
|
||||
import agentCreationUserPrompt from "../../prompts/system/agent-creation-user.md" with { type: "text" };
|
||||
import { createAgentSession } from "../../sdk";
|
||||
import { discoverAgents } from "../../task/discovery";
|
||||
import { resolveAgentPrewalkDefault } from "../../task/prewalk";
|
||||
import type { AgentDefinition, AgentSource } from "../../task/types";
|
||||
import { shortenPath } from "../../tools/render-utils";
|
||||
import { getEditorTheme, theme } from "../theme/theme";
|
||||
@@ -602,7 +603,7 @@ export class AgentDashboard extends Container {
|
||||
this.#persistPrewalkOverrides();
|
||||
const pattern = resolveAgentPrewalkPattern({
|
||||
settingsOverride: selected.prewalkOverride,
|
||||
agentPrewalk: selected.prewalk,
|
||||
agentPrewalk: resolveAgentPrewalkDefault(selected, this.#settingsManager?.get("task.prewalk") ?? false),
|
||||
});
|
||||
const state = selected.prewalkOverride ?? "agent default";
|
||||
this.#notice = `Prewalk for ${selected.name}: ${state}${pattern ? ` (into ${pattern})` : ""}`;
|
||||
@@ -1081,7 +1082,10 @@ export class AgentDashboard extends Container {
|
||||
const prewalkPattern = selected
|
||||
? resolveAgentPrewalkPattern({
|
||||
settingsOverride: selected.prewalkOverride,
|
||||
agentPrewalk: selected.prewalk,
|
||||
agentPrewalk: resolveAgentPrewalkDefault(
|
||||
selected,
|
||||
this.#settingsManager?.get("task.prewalk") ?? false,
|
||||
),
|
||||
})
|
||||
: undefined;
|
||||
const prewalkResolution = prewalkPattern ? this.#resolvePatterns([prewalkPattern]) : undefined;
|
||||
|
||||
@@ -55,6 +55,7 @@ import type { EventBus } from "../utils/event-bus";
|
||||
import { buildNamedToolChoice } from "../utils/tool-choice";
|
||||
import type { WorkspaceTree } from "../workspace-tree";
|
||||
import { generateTaskLabel } from "./label";
|
||||
import { resolveAgentPrewalkDefault } from "./prewalk";
|
||||
import { subprocessToolRegistry } from "./subprocess-tool-registry";
|
||||
import {
|
||||
type AgentDefinition,
|
||||
@@ -2451,11 +2452,9 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
|
||||
// frontmatter default; the `task.prewalk` toggle (default off) arms it.
|
||||
// Resolution failures skip prewalk instead of failing the spawn.
|
||||
let prewalk: Prewalk | undefined;
|
||||
const genericTaskPrewalk =
|
||||
agent.source === "bundled" && agent.name === "task" && settings.get("task.prewalk") ? true : undefined;
|
||||
const prewalkPattern = resolveAgentPrewalkPattern({
|
||||
settingsOverride: settings.get("task.agentPrewalk")[agent.name],
|
||||
agentPrewalk: agent.prewalk ?? genericTaskPrewalk,
|
||||
agentPrewalk: resolveAgentPrewalkDefault(agent, settings.get("task.prewalk")),
|
||||
});
|
||||
if (prewalkPattern) {
|
||||
const resolvedPrewalk = resolveModelOverride([prewalkPattern], modelRegistry, settings);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { AgentDefinition } from "./types";
|
||||
|
||||
/** Resolve an agent's prewalk default, including the bundled task opt-in. */
|
||||
export function resolveAgentPrewalkDefault(agent: AgentDefinition, taskPrewalk: boolean): boolean | string | undefined {
|
||||
return agent.prewalk ?? (taskPrewalk && agent.source === "bundled" && agent.name === "task" ? true : undefined);
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, test, vi } from "bun:test";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import type { Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
|
||||
import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
|
||||
import { AgentDashboard } from "@oh-my-pi/pi-coding-agent/modes/components/agent-dashboard";
|
||||
import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
||||
import * as discovery from "@oh-my-pi/pi-coding-agent/task/discovery";
|
||||
@@ -236,3 +236,19 @@ describe("AgentDashboard tab navigation", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("AgentDashboard prewalk", () => {
|
||||
test("shows the bundled task prewalk default when task.prewalk is enabled", async () => {
|
||||
await initTheme(false);
|
||||
vi.spyOn(discovery, "discoverAgents").mockResolvedValue({
|
||||
projectAgentsDir: null,
|
||||
agents: [{ name: "task", description: "Generic task agent", systemPrompt: "", source: "bundled" }],
|
||||
});
|
||||
const settings = Settings.isolated({ "task.prewalk": true });
|
||||
const dashboard = await AgentDashboard.create(await makeTempCwd(), settings, 24, {});
|
||||
const rendered = dashboard.render(100).join("\n").replace(ANSI_PATTERN, "");
|
||||
|
||||
expect(rendered).toContain("Prewalk: on");
|
||||
expect(rendered).not.toContain("Prewalk: off");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user