Skip to content

fix: adapt before_agent_start prompt extraction and child process detection for modern Pi - #42

Merged
btnalit merged 6 commits into
mainfrom
fix/pi-v1-compatibility
Oct 23, 2026
Merged

btnalit merged 6 commits into
mainfrom
fix/pi-v1-compatibility

Conversation

@btnalit

@btnalit btnalit commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR improves compatibility with modern Pi (v1.x) runtimes and resolves upstream CI security audit failures:

  1. Defensive prompt extraction in before_agent_start:

    • In modern Pi versions, BeforeAgentStartEvent is a union where custom messages (e.g. subagents, autonomous turn triggers) omit event.prompt, or prompt may arrive as an array of content blocks.
    • Extract string text safely and skip whitespace/empty prompts defensively without throwing TypeError.
    • Update lastRecall state only after verifying a valid prompt is present, preventing non-prompt turns from marking recall as failed.
  2. Expanded child subagent detection:

    • Recognize modern pi-subagents standard environment variables (PI_SUBAGENT_CHILD=1 and PI_SUBAGENT_RUNNER_PID) alongside legacy PI_SUBAGENT_AGENT_ID to ensure subagents do not instantiate duplicate memory stores.
  3. CI Security Audit Overrides:

    • Add package.json dependency overrides for brace-expansion (^5.0.12) and undici (^8.10.2) to resolve high-severity audit advisories in dev dependencies (GHSA-q2hr-2g5m-vwhr, GHSA-3wwx-pv8p-q78v) that were failing CI. Both overrides remain on the same major versions used by @earendil-works/pi-coding-agent@0.85.1.
  4. Testing:

    • Added unit test cases for child-process env vars and before_agent_start edge cases.
    • All 313 unit tests pass and all GitHub Actions CI checks are green.

dependabot Bot and others added 4 commits October 5, 2026 06:21
…ctory with 2 updates

Bumps the development-minor-patch group with 2 updates in the / directory: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) and [typebox](https://github.com/sinclairzx81/typebox).


Updates `@types/node` from 22.20.2 to 22.20.5
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `typebox` from 1.3.31 to 1.3.34
- [Commits](sinclairzx81/typebox@1.3.31...1.3.34)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 22.20.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: development-minor-patch
- dependency-name: typebox
  dependency-version: 1.3.34
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: development-minor-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps the actions-minor-patch group with 3 updates: [actions/setup-node](https://github.com/actions/setup-node), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/download-artifact](https://github.com/actions/download-artifact).


Updates `actions/setup-node` from 7.0.0 to 7.1.0
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](actions/setup-node@8207627...949feb2)

Updates `actions/upload-artifact` from 7.0.1 to 7.0.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@043fb46...cf430e0)

Updates `actions/download-artifact` from 8.0.1 to 8.0.2
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@3e5f45b...9000827)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-minor-patch
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-minor-patch
- dependency-name: actions/download-artifact
  dependency-version: 8.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-minor-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@btnalit
btnalit merged commit 4d78bcd into main Oct 23, 2026
8 checks passed
@btnalit
btnalit deleted the fix/pi-v1-compatibility branch October 23, 2026 06:50
btnalit pushed a commit that referenced this pull request Oct 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.4.3](v0.4.2...v0.4.3)
(2026-10-23)


### Bug Fixes

* adapt before_agent_start prompt extraction and child process detection
for modern Pi
([#42](#42))
([4d78bcd](4d78bcd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant