Repository navigation
Support Pi 1.5 and edit the context only at the threshold - #14
Merged
Merged
Conversation
Pi 1.5 no longer exports Type from pi-ai, so the extension imports it from typebox, which Pi 1.0.3 and 1.5 both provide to extensions. Development now uses Pi 1.5.2; the tests pass on 1.5.2 and 1.0.3. The faux provider in Pi 1.0 counts a session's first prompt as both input and cache write, so the tests disable its cache to get the same usage on every version. Every context edit changes the prompt prefix. The provider then reads all later text without its cache, and Anthropic drops every thinking block after the edit. In local sessions, superseded-read edits below the threshold cost about 4.8 times the input tokens they saved, and a second edit within a few turns of the previous one often missed the whole cache. Superseded reads are therefore replaced only above the threshold, in the same batch as pruning and shaking, and anywhere in the context. Without a compaction, edits are kept only when they bring the context to the threshold or below, so they do not repeat at each turn. The staleSuffixTokens setting no longer has a purpose and is removed. Also: cancel obsolete background handoff requests after session-tree navigation, and state recall's limits (current branch only, images as MIME types).
…in CI Align the repository with pi-claude-pro. A GitHub release is now the only release step: its tag sets the version and its generated notes replace CHANGELOG.md, which removes the release PR, the manual tag push, the dispatch, and the release script with its tests. The workflow still requires the owner, a vX.Y.Z tag on main with green CI, and approval of the npm environment. Tags can move; commit SHAs cannot, so workflow actions are pinned and Dependabot keeps them current with a 7-day cooldown. zizmor checks the workflows and CodeQL scans the TypeScript and the workflows. CI now also checks Pi 1.0.3, the oldest supported version. Pi's packages depend on each other with caret ranges, so installing only pi-coding-agent@1.0.3 mixes in newer sub-packages; every Pi package is pinned, as in a real install.
The locked vite 8.3.2, a dev dependency through vitest, has open advisories for files served outside server.fs.allow and for launch-editor. npm audit now reports no vulnerabilities.
This repository allows only GitHub-owned actions, so the zizmor action could not start and CI failed at startup. CodeQL's default setup already scans actions and TypeScript weekly here, and GitHub rejects an advanced CodeQL workflow while it is enabled.
HugoLopes45
added a commit
that referenced
this pull request
Nov 11, 2026
## Why - **Shake ran when pruning was already enough.** After a handoff, `turn_end` decided whether to shake from Pi's raw token count, not from the planned result. With the default `methodOrder`, pruning could bring the context under the target and old code blocks were still elided. That is one more cache break and lost content the model may still need. - **README was wrong about `compaction.enabled: false`.** Since #14, edits happen only at the threshold. With Pi's compaction off there is no threshold, so nothing changes. The README said old file reads were still replaced. - **Install scripts ran in the release job.** That job holds `id-token: write` for npm trusted publishing. Three transitive dev dependencies (`@google/genai`, `protobufjs`, `fsevents`) declare install scripts; the checks do not need them. ## Changes - `extensions/index.ts`: gate the shake after handoff on `result.tokens`. - `test/extension.test.ts`: regression test. It failed before the fix with an `Elided block` replacement and passes after. - `README.md`: two lines on `compaction.enabled: false`. - `ci.yml`, `release.yml`: `npm ci --ignore-scripts`, and `--ignore-scripts` for the Pi 1.0.3 and latest installs. ## Verification - `npx tsc --noEmit`: pass. - `npx vitest --run`: 93 passed. - A local install with `npm ci --ignore-scripts` passes the full suite. Found by an `hl-improve` survey and an `hl-security-audit` pass (no confirmed vulnerability; this is hardening).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Typefrom@earendil-works/pi-ai, so the extension did not load on current Pi.What
Commit 1, behavior:
Typefromtypebox, which Pi 1.0.3 and 1.5 both provide to extensions. Development uses Pi 1.5.2.staleSuffixTokenssetting. A configured value now reportscontextKit.staleSuffixTokens is not a setting. The next release should be a minor version.recallin the README.Commit 2, repository (aligned with pi-claude-pro):
CHANGELOG.md. The release script and its tests are removed. See CONTRIBUTING.md.Commit 3: vite 8.3.2 to 8.3.8 (dev dependency through vitest) for its open advisories.
npm auditreports no vulnerabilities.Not included: a cyclomatic complexity limit like pi-claude-pro's. Five functions exceed 10 (the
turn_endhandler is at 35); they need a refactor in a separate PR.Checks
npm run checkpasses: 92 tests andtscon the locked Pi 1.5.2.tscon the locked Pi 1.5.2 (Node 22 and 24), on Pi 1.0.3, and on latest Pi.actionlintandzizmorreport no findings.After merge: the npm trusted publisher and the
npmenvironment stay as they are; the workflow file namerelease.ymlis unchanged.Optional repository setting: pi-claude-pro's CodeQL uses the
security-and-qualityquery suite; the default setup here usesdefault.