fix(coding-agent): soften PI environment guideline

Attempt to address #7128 without closing the issue.
This commit is contained in:
Armin Ronacher 2026-08-06 22:49:47 +02:00
parent c96bfaccd0
commit 4e64de6950
5 changed files with 12 additions and 8 deletions

View file

@ -6,6 +6,10 @@
- Added `pi auth check` provider/model auth preflight with optional credential output ([#7152](https://github.com/earendil-works/pi/issues/7152)).
### Changed
- Softened the bash tool's `PI_*` environment guideline in an attempt to reduce unnecessary inspection commands ([#7128](https://github.com/earendil-works/pi/issues/7128)).
### Fixed
- Fixed right-click not pasting clipboard text in fullscreen mode on Windows.

View file

@ -44,7 +44,7 @@ const bashSchema = Type.Object({
export const bashToolSystemPromptContribution = {
snippet: "Execute bash commands (ls, grep, find, etc.)",
guidelines: ["Inspect PI_* environment variables for current model and session details."],
guidelines: ["You can inspect PI_* environment variables for current model and session details."],
} as const;
export type BashToolInput = Static<typeof bashSchema>;

View file

@ -74,7 +74,7 @@ describe("AgentSession dynamic tool registration", () => {
const bashTool = session.agent.state.tools.find((tool) => tool.name === "bash")!;
expect(session.systemPrompt).toContain(
"Inspect PI_* environment variables for current model and session details.",
"You can inspect PI_* environment variables for current model and session details.",
);
await bashTool.execute("bash-env", { command: "printf ok" });
expect(sessionEnv).toMatchObject({

View file

@ -105,7 +105,7 @@ describe("createAgentSession session manager defaults", () => {
});
expect(session.sessionFile).toBeTruthy();
expect(session.systemPrompt).toContain(
"Inspect PI_* environment variables for current model and session details.",
"You can inspect PI_* environment variables for current model and session details.",
);
const bashTool = session.agent.state.tools.find((tool) => tool.name === "bash");

View file

@ -52,7 +52,7 @@ function createPromptTool(name: string, promptSnippet?: string, promptGuidelines
const defaultPromptTools = [
createPromptTool("read", "Read file contents", ["Use read to examine files instead of cat or sed."]),
createPromptTool("bash", "Execute bash commands (ls, grep, find, etc.)", [
"Inspect PI_* environment variables for current model and session details.",
"You can inspect PI_* environment variables for current model and session details.",
]),
createPromptTool("edit", "Edit files", ["Edit carefully."]),
createPromptTool("write", "Create or overwrite files", ["Use write only for new files or complete rewrites."]),
@ -96,9 +96,9 @@ describe("coding-agent Harness construction", () => {
expect(prompt).toContain("- read: Read file contents");
expect(prompt).toContain("- bash: Execute bash commands (ls, grep, find, etc.)");
expect(prompt).toContain("Use read to examine files instead of cat or sed.");
expect(prompt).toContain("Inspect PI_* environment variables for current model and session details.");
expect(prompt).toContain("You can inspect PI_* environment variables for current model and session details.");
expect(prompt.indexOf("Use read to examine files")).toBeLessThan(
prompt.indexOf("Inspect PI_* environment variables"),
prompt.indexOf("You can inspect PI_* environment variables"),
);
});
@ -290,7 +290,7 @@ describe("coding-agent Harness construction", () => {
[
"bash",
"Execute bash commands (ls, grep, find, etc.)",
"Inspect PI_* environment variables for current model and session details.",
"You can inspect PI_* environment variables for current model and session details.",
],
["read", "Read file contents", "Use read to examine files instead of cat or sed."],
[
@ -342,7 +342,7 @@ describe("coding-agent Harness construction", () => {
expect(prompt).toContain("- write: Create or overwrite files");
expect(prompt).toContain("- read: Read file contents");
expect(prompt).not.toContain("- bash:");
expect(prompt).not.toContain("Inspect PI_* environment variables");
expect(prompt).not.toContain("You can inspect PI_* environment variables");
expect(prompt).toContain('<project_instructions path="/workspace/AGENTS.md">');
expect(prompt).toContain("<name>review</name>");
expect(prompt.indexOf("Use write only for new files or complete rewrites.")).toBeLessThan(