Mario Zechner 2f64df1e52 fix(coding-agent): prevent duplicate session headers when forking from pre-assistant entry
createBranchedSession() wrote the file and set flushed=true even when the
branched path had no assistant message. The next _persist() call saw no
assistant, reset flushed=false, and the subsequent flush appended all
in-memory entries to the already-populated file, duplicating the header
and entries.

Fix: defer file creation when the branched path has no assistant message,
matching the newSession() contract. _persist() creates the file on the
first assistant response.

closes #1672
2f64df1e52 · 2026-02-27 22:18:26 +01:00
3,012 Commits
2026-02-12 19:52:51 +00:00
2026-02-01 22:25:07 +01:00
2026-02-27 21:04:00 +01:00
2026-02-22 19:56:08 +01:00
2025-12-30 22:42:21 +01:00

🏖️ OSS Vacation

Issue tracker and PRs reopen March 2, 2026.

All PRs will be auto-closed until then. Approved contributors can submit PRs after vacation without reapproval. For support, join Discord.


pi logo

Discord Build status

pi.dev domain graciously donated by

Exy mascot
exe.dev

Pi Monorepo

Looking for the pi coding agent? See packages/coding-agent for installation and usage.

Tools for building AI agents and managing LLM deployments.

Packages

Package Description
@mariozechner/pi-ai Unified multi-provider LLM API (OpenAI, Anthropic, Google, etc.)
@mariozechner/pi-agent-core Agent runtime with tool calling and state management
@mariozechner/pi-coding-agent Interactive coding agent CLI
@mariozechner/pi-mom Slack bot that delegates messages to the pi coding agent
@mariozechner/pi-tui Terminal UI library with differential rendering
@mariozechner/pi-web-ui Web components for AI chat interfaces
@mariozechner/pi-pods CLI for managing vLLM deployments on GPU pods

Contributing

See CONTRIBUTING.md for contribution guidelines and AGENTS.md for project-specific rules (for both humans and agents).

Development

npm install          # Install all dependencies
npm run build        # Build all packages
npm run check        # Lint, format, and type check
./test.sh            # Run tests (skips LLM-dependent tests without API keys)
./pi-test.sh         # Run pi from sources (must be run from repo root)

Note: npm run check requires npm run build to be run first. The web-ui package uses tsc which needs compiled .d.ts files from dependencies.

License

MIT

S
Description
No description provided
Readme MIT 163 MiB
Languages
TypeScript 93.5%
JavaScript 5.7%
CSS 0.3%
Shell 0.3%
C 0.1%