Skip to content

[3836 by Claude Opus 5.5] Pi: goal support with session resume - #3859

Merged
integry merged 1 commit into
3831-epic-pi-coding-jmlfrom
3836/claude-opus-5-5-pi-goal-support-with-sess-20261127-2116-7kz
Nov 27, 2026
Merged

integry merged 1 commit into
3831-epic-pi-coding-jmlfrom
3836/claude-opus-5-5-pi-goal-support-with-sess-20261127-2116-7kz

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3836

Branch: 3836/claude-opus-5-5-pi-goal-support-with-sess-20261127-2116-7kz
Commits: ✅ Changes committed (1c117d7)


AI Processing Completed

Execution Details:

  • Issue: Pi: goal support with session resume #3836
  • Repository: integry/propr
  • Status: Success
  • Execution Time: 31m 45s
  • Tokens used: 15.82M tokens [15.82M input + 1.75K output]
  • API cost: $3.86
  • Timestamp: Nov 27, 2026, 9:48 PM UTC
  • LLM Model: Claude Opus 5.5

Summary:
Goals can now run on Pi. A goal keeps a single Pi session across all its runs, and every later run reopens that session file, so the conversation carries through checkpoints, pauses, corrections and model changes.

How it works

  • Capability: goalCapabilities reports Pi as goal-capable with launch: 'goal-prompt', resume: 'whole-session', runningInput: 'safe-boundary-resume'. The probe runs pi --help offline with nothing mounted and requires the session flags (-p, --mode, --session, --session-id, --session-dir, --no-session). PiAgent.goalCapable is now true.
  • Where sessions live: each goal gets its own directory at /tmp/git-processor/pi-goal-sessions/<goal-id> (override with PI_GOAL_SESSIONS_PATH), outside Pi's disposable home. It's created at 0700 and mounted into the run.
  • Owner-only: scripts/pi-entrypoint.sh chowns the mounted directory to node and sets it and its files to owner-only before Pi starts and again after it exits, including after a stop. Without this, Pi's session files come out world-readable (0644).
  • New goal: the first run uses --session-id <uuid>, an ID ProPR assigns. The ID is saved as soon as the stream shows Pi has written the prompt to the session file. A run stopped before that saves nothing, so the next attempt starts fresh instead of resuming an empty session. To read that moment from the stream I added a small sessionIdFromLine option to the shared docker executor.
  • Resume: later runs use --session <exact file>. If you point Pi 1.6.1 at a file that doesn't exist, it quietly starts an empty session there. So the worker checks the file exists first and fails the goal with a clear error if it's gone.
  • Boundaries: checkpoints, model changes, pause and input go through the existing whole-session path in processGoalJob.ts. Goal input is sent to Pi unchanged, and direct goals protect the .git metadata.
  • Environment: Pi now passes the per-run environment (goal mode, launch strategy, admission parent and its key) into the container by variable name. Before this, Pi dropped it; this applies to task runs too.
  • Cleanup: deleting a goal removes its session directory. A finished goal keeps it so it can be continued.
  • RPC mode (--mode rpc live steering) is not implemented; I documented it as a follow-up in docs/docs/features/goals.md.

The docs are also updated in agents-and-models.md and architecture/agent-runtime.md.

Testing

  • New test/piGoalSession.test.ts (16 tests) covers the capability probe against the real Pi 1.6.1 help output, session store permissions, --session-id vs --session args, and the missing-file failure. It also covers a run that resumes and keeps the earlier conversation, and a resume after a checkpoint that delivers the checkpoint feedback into the same session.
  • Two entrypoint tests in test/piCredentials.test.ts cover the owner-only permissions and refusing unsafe or missing directories.
  • Separately, I ran the real Pi 1.6.1 binary through the real entrypoint against a mock model server. It created the session under the assigned ID and resumed it with the conversation intact ("seen 2 user messages"), with files at 0600 and directories at 0700.
  • Typecheck passes for core, root and api, and lint is clean on the changed files. The existing Pi, goal, docker-executor and processGoalJob suites pass.
  • The API goal route tests are only partly checked. goalRoutes.test.ts passes alone (it contains delete-route cases). Run together with goalContinueRoute and goalCliRoutes, it hit a 600s timeout with almost no output; that looks like the known hang at exit in packages/api tests, but I didn't confirm it.

There are no visual previews because nothing in the UI changes.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (11 files)
    • packages/api/routes/goalRoutes.ts (+5/−0)
    • packages/core/src/agents/goalCapabilities.ts (+24/−0)
    • packages/core/src/agents/impl/PiAgent.ts (+52/−8)
    • packages/core/src/agents/impl/utils/piDockerArgsBuilder.ts (+20/−7)
    • packages/core/src/agents/impl/utils/piGoalSession.ts (added, +119/−0)
    • packages/core/src/agents/types.ts (+5/−0)
    • packages/core/src/claude/docker/dockerExecutor.ts (+3/−1)
    • packages/core/src/claude/docker/dockerSessionOutput.ts (+3/−1)
    • packages/core/src/goalExports.ts (+2/−0)
    • scripts/pi-entrypoint.sh (+41/−0)
    • src/jobs/processGoalJob.ts (+1/−0)
  • Low risk (6 files)
    • docs/docs/architecture/agent-runtime.md (+4/−0)
    • docs/docs/features/agents-and-models.md (+3/−3)
    • docs/docs/features/goals.md (+13/−1)
    • packages/core/test/fixtures/pi-help-1.6.1.txt (added, +198/−0)
    • test/piCredentials.test.ts (+33/−0)
    • test/piGoalSession.test.ts (added, +328/−0)

Diff size: 17 files changed, +854/−21 lines

View task for the run's logs and conversation.


This PR was created automatically by ProPR after processing issue #3836.


💡 Need changes?

Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!

Goals can now run on Pi. A goal keeps a single Pi session across all its runs, and every later run reopens that session file, so the conversation carries through checkpoints, pauses, corrections and model changes.

How it works
- Capability: `goalCapabilities` reports Pi as goal-capable with `launch: 'goal-prompt'`, `resume: 'whole-session'`, `runningInput: 'safe-boundary-resume'`. The probe runs `pi --help` offline with nothing mounted and requires the session flags (`-p`, `--mode`, `--session`, `--session-id`, `--session-dir`, `--no-session`). `PiAgent.goalCapable` is now `true`.
- Where sessions live: each goal gets its own directory at `/tmp/git-processor/pi-goal-sessions/<goal-id>` (override with `PI_GOAL_SESSIONS_PATH`), outside Pi's disposable home. It's created at 0700 and mounted into the run.
- Owner-only: `scripts/pi-entrypoint.sh` chowns the mounted directory to `node` and sets it and its files to owner-only before Pi starts and again after it exits, including after a stop. Without this, Pi's session files come out world-readable (0644).
- New goal: the first run uses `--session-id <uuid>`, an ID ProPR assigns. The ID is saved as soon as the stream shows Pi has written the prompt to the session file. A run stopped before that saves nothing, so the next attempt starts fresh instead of resuming an empty session. To read that moment from the stream I added a small `sessionIdFromLine` option to the shared docker executor.
- Resume: later runs use `--session <exact file>`. If you point Pi 1.6.1 at a file that doesn't exist, it quietly starts an empty session there. So the worker checks the file exists first and fails the goal with a clear error if it's gone.
- Boundaries: checkpoints, model changes, pause and input go through the existing whole-session path in `processGoalJob.ts`. Goal input is sent to Pi unchanged, and direct goals protect the `.git` metadata.
- Environment: Pi now passes the per-run environment (goal mode, launch strategy, admission parent and its key) into the container by variable name. Before this, Pi dropped it; this applies to task runs too.
- Cleanup: deleting a goal removes its session directory. A finished goal keeps it so it can be continued.
- RPC mode (`--mode rpc` live steering) is not implemented; I documented it as a follow-up in `docs/docs/features/goals.md`.

The docs are also updated in `agents-and-models.md` and `architecture/agent-runtime.md`.

Testing
- New `test/piGoalSession.test.ts` (16 tests) covers the capability probe against the real Pi 1.6.1 help output, session store permissions, `--session-id` vs `--session` args, and the missing-file failure. It also covers a run that resumes and keeps the earlier conversation, and a resume after a checkpoint that delivers the checkpoint feedback into the same session.
- Two entrypoint tests in `test/piCredentials.test.ts` cover the owner-only permissions and refusing unsafe or missing directories.
- Separately, I ran the real Pi 1.6.1 binary through the real entrypoint against a mock model server. It created the session under the assigned ID and resumed it with the conversation intact ("seen 2 user messages"), with files at 0600 and directories at 0700.
- Typecheck passes for core, root and api, and lint is clean on the changed files. The existing Pi, goal, docker-executor and `processGoalJob` suites pass.
- The API goal route tests are only partly checked. `goalRoutes.test.ts` passes alone (it contains delete-route cases). Run together with `goalContinueRoute` and `goalCliRoutes`, it hit a 600s timeout with almost no output; that looks like the known hang at exit in `packages/api` tests, but I didn't confirm it.

There are no visual previews because nothing in the UI changes.

ProPR-Agent: claude/claude-opus-5-5
@propr-dev

propr-dev Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

/ultrafix goal=8 max=8
Triggered automatically by the requested execution settings.

@propr-dev propr-dev Bot added the ultrafix label Nov 27, 2026
@propr-dev

propr-dev Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 8)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev

propr-dev Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR adds Pi goals through persistent per-goal session storage and the existing whole-session execution path. The changes are focused and appear merge-ready within the supplied scope, conditional on the five pending checks completing successfully.

✅ Explicit session resume — Resumed runs select the saved session file and fail before launching Pi when that file is missing.

✅ Separated session storage — Goal sessions survive disposable-home cleanup, and the entrypoint restricts directory and file permissions before and after execution.

✅ Focused coverage — Added tests cover session identity, checkpoint feedback, model changes, missing files, environment forwarding, and preservation of ordinary task behavior.

This was a static review of the supplied diff and context; no commands or tests were run.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S1: 🟢 Automate interrupted-session integration coverage

The new stand-in writes the session file itself before emitting the user’s message_end, so it assumes the persistence ordering that createPiSessionSavedDetector relies on. Consider retaining the reported real-Pi/mock-server experiment as an automated integration test, including interruption after that event and subsequent resume. This would help detect runtime changes; it is optional given the supplied runtime verification and existing unit coverage.

Score

The implementation is cohesive and includes relevant regression coverage, with no verified merge blockers in the supplied code. Current checks report no failures, although five remain pending.

Score: 8/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 32s
  • Tokens: 68,193 (67,622 in / 571 out)
  • Cost: $0.57

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S1

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 27, 2026
@integry
integry merged commit bfec54d into 3831-epic-pi-coding-jml Nov 27, 2026
67 checks passed
@propr-dev propr-dev Bot changed the title 🔨 [3836 by Claude Opus 5.5] Pi: goal support with session resume [3836 by Claude Opus 5.5] Pi: goal support with session resume Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant