fix(pi): declare the compaction extension Pi-only at the package level - #2729
Merged
Conversation
atomic reads `~/.pi/agent/settings.json` as a legacy config root, so it
inherits every extension registered for pi. `pi-openai-server-compaction`
imports `@earendil-works/pi-coding-agent` as a runtime value in
`src/remote-compaction.ts`; pi's jiti `virtualModules` map satisfies that
specifier, atomic 0.9.13's does not, and the resolution failure is fatal on
atomic's print and interactive paths. The other registered extensions survive
only because their references to that specifier are `import type`, erased at
transpile.
atomic's manifest reader is `APP_NAME`-first with a `pi` fallback
(`packages/coding-agent/src/core/package-manager-manifest.ts:24-27`) and
`APP_NAME` is `"atomic"`, while pi reads only `pkg.pi`. Injecting
`{atomic: {extensions: []}}` therefore short-circuits atomic to zero resources
and is invisible to pi. The derivation becomes a `stdenvNoCC.mkDerivation`
over the existing fetch, following the sibling `pi-agent-extensions` shape,
and drops the `-source` suffix now that the output is no longer a bare fetch.
The package remains a separate enabled entry and still appears in
`atomic list`, satisfying the OpenSpec MUST at
`openspec/specs/pi-agent-environment/spec.md:74`. Nothing is added to
`programs.pi-coding-agent.settings`, so `slowModeSettingsShape` is untouched.
Verified with the four checks that observe this derivation or its store path,
which is the full set that would fail if the change were wrong:
- `package-pi-openai-server-compaction` builds the derivation itself.
- `pi-agent-environment-structural` covers `compactionRetained`, which derives
both sides of its comparison from the package and so follows the new path.
- `pi-agent-environment-smoke` is the real regression test: its fixture uses
the live `packageEntries` and hard-fails on any `extension_error`. It
reported `extension_errors=0`.
- `home-manager-crs58` covers the consumer that embeds the store path in the
generated settings file.
Runtime behaviour was confirmed in an isolated `HOME` against scratch copies,
never the captain's live config, with a marker line appended to the extension
entrypoint. atomic on the old output fails with the verbatim
`Cannot find module` error; atomic on the new output reaches `No API key
found`; pi prints the marker on both, proving it still evaluates the extension
rather than merely not erroring. `atomic list` was not used as an oracle: it
renders this failure as a warning and exits 0.
Deliberately left out: no atomic regulator was added to the checks suite. The
gap is real (nothing in the repo could have caught this) but adding one is a
separate decision.
cameronraysmith
marked this pull request as ready for review
August 17, 2026 01:01
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 39 seconds in the queue, including 6 seconds running CI. Required conditions to merge
|
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.
Problem
atomicreads~/.pi/agent/settings.jsonas a legacy config root, so it inherits every extension registered for pi.One of them,
pi-openai-server-compaction, imports@earendil-works/pi-coding-agentas a runtime value insrc/remote-compaction.ts.pi's jiti
virtualModulesmap satisfies that specifier; atomic 0.9.13's does not, and the resolution failure is fatal on atomic's print and interactive paths:The other registered extensions survive only because their references to that specifier are
import type, erased at transpile.Fix
atomic's manifest reader is
APP_NAME-first with apifallback (packages/coding-agent/src/core/package-manager-manifest.ts:24-27) andAPP_NAMEis"atomic", while pi reads onlypkg.pi.Injecting
{atomic: {extensions: []}}into the package'spackage.jsontherefore short-circuits atomic to zero resources and is invisible to pi.pkgs/by-name/pi-openai-server-compaction/package.nixbecomes astdenvNoCC.mkDerivationover the existingfetchFromGitHub, following the siblingpi-agent-extensionsshape, and drops the-sourcesuffix now that the output is no longer a bare fetch.The
wsruntime-dependency comment is preserved verbatim.Constraints held
atomic list, satisfying the OpenSpec MUST atopenspec/specs/pi-agent-environment/spec.md:74.programs.pi-coding-agent.settings, soslowModeSettingsShapeis untouched.compactionRetainedderives both sides of its comparison fromself'.packages.pi-openai-server-compaction, so it follows the new store path.Verification
Ran the four checks that observe this derivation or its store path — the full set that would fail if the change were wrong. All green:
pi-agent-environment-smokeis the real regression test: its fixture uses the livepackageEntriesand hard-fails on anyextension_error.It reported
extension_errors=0.Runtime behaviour was confirmed in an isolated
HOMEagainst scratch copies of the old and new outputs — never the captain's live config — with a marker line appended to the extension entrypoint:Cannot find module '@earendil-works/pi-coding-agent', exit 1No API key found for the selected model.>>> VX_COMPACTION_EXTENSION_EVALUATED>>> VX_COMPACTION_EXTENSION_EVALUATEDThe marker is positive proof that pi still evaluates the extension rather than merely not erroring.
atomic listwas deliberately not used as an oracle: it renders this failure as aWarning:and exits 0, while the print and interactive paths render it asError:and exit 1.Deliberately out of scope
No atomic regulator was added to the checks suite.
The gap is real — nothing in the repo could have caught this, since
pi-agent-environment-smokeis bound tomainProgram == "pi"and atomic's own--helptest runs under an emptyHOME— but adding one is a separate decision.Also untouched:
ATOMIC_CODING_AGENT_DIRhandling, the pi module's settings, and the deletednode_modulesoutput assertion.Provenance
Diagnosis, fix selection, and the end-to-end verification with negative control come from the completed investigation at
data/vx-atomic-pi-config-inheritance/report.md.