Skip to content

feat(harness): integrate pi runtime into desktop app#3469

Merged
jonathanlab merged 2 commits into
mainfrom
07-15-feat_harness_integrate_pi_runtime_into_desktop_app
Jul 20, 2026
Merged

feat(harness): integrate pi runtime into desktop app#3469
jonathanlab merged 2 commits into
mainfrom
07-15-feat_harness_integrate_pi_runtime_into_desktop_app

Conversation

@jonathanlab

@jonathanlab jonathanlab commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

This sets up all the wiring needed to run Pi in the desktop app. We use a dummy conversation view, which is replaced by the ChatThread in the next PR.

it also alters taskmetadata to store pi session files, for local dev. this is probably a temporary solution

ALTER TABLE `task_metadata` ADD `pi_session_file` text;

jonathanlab commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 92aa2f9.

@jonathanlab
jonathanlab marked this pull request as ready for review July 15, 2026 11:34
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Security Review

The new Pi-session routes do not validate task ownership before controlling sessions or returning events. The child process also receives a reusable OAuth credential snapshot through its environment, which can become invalid when refresh tokens rotate.

Reviews (1): Last reviewed commit: "feat(harness): integrate pi runtime into..." | Re-trigger Greptile

Comment thread packages/host-router/src/routers/pi-session.router.ts
Comment thread packages/workspace-server/src/services/pi-session/pi-session.ts Outdated
Comment thread apps/code/vite-main-plugins.mts
Comment thread packages/agent/src/pi/rpc-client.ts Outdated
Comment on lines 34 to 41
const oauthEnvironment: Record<string, string> = {
POSTHOG_OAUTH_CREDENTIALS: JSON.stringify(oauthCredentials),
};
const childEnvironment: Record<string, string> = {
...env,
...oauthEnvironment,
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security Child Credentials Diverge After Refresh

The child receives a one-time copy of the desktop access and refresh tokens. If the provider rotates refresh tokens and the parent refreshes first, the long-running child retains the invalidated token and its next refresh fails even though the desktop remains signed in, interrupting the Pi session.

@jonathanlab
jonathanlab changed the base branch from pi-harness-runtime to graphite-base/3469 July 15, 2026 11:45
@jonathanlab
jonathanlab force-pushed the 07-15-feat_harness_integrate_pi_runtime_into_desktop_app branch from 745cd4b to b8845b7 Compare July 15, 2026 14:00
@jonathanlab
jonathanlab changed the base branch from graphite-base/3469 to pi-harness-runtime July 15, 2026 14:00
@jonathanlab
jonathanlab changed the base branch from pi-harness-runtime to graphite-base/3469 July 15, 2026 14:15
@jonathanlab
jonathanlab force-pushed the 07-15-feat_harness_integrate_pi_runtime_into_desktop_app branch from b8845b7 to 9485f63 Compare July 15, 2026 14:23
@jonathanlab
jonathanlab changed the base branch from graphite-base/3469 to pi-harness-runtime July 15, 2026 14:23
@jonathanlab
jonathanlab changed the base branch from pi-harness-runtime to graphite-base/3469 July 15, 2026 14:37
@jonathanlab
jonathanlab force-pushed the 07-15-feat_harness_integrate_pi_runtime_into_desktop_app branch from 9485f63 to 401dd8d Compare July 15, 2026 14:42
@jonathanlab
jonathanlab changed the base branch from graphite-base/3469 to pi-harness-runtime July 15, 2026 14:42
@jonathanlab
jonathanlab force-pushed the 07-15-feat_harness_integrate_pi_runtime_into_desktop_app branch 2 times, most recently from ed3507d to 3185f38 Compare July 17, 2026 09:03
Comment thread packages/agent/src/pi/rpc-client.ts Outdated
@veria-ai

veria-ai Bot commented Jul 17, 2026

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 3 · PR risk: 0/10

@jonathanlab
jonathanlab force-pushed the 07-15-feat_harness_integrate_pi_runtime_into_desktop_app branch 2 times, most recently from fc88402 to 32ed95f Compare July 17, 2026 09:43
@jonathanlab
jonathanlab force-pushed the 07-15-feat_harness_integrate_pi_runtime_into_desktop_app branch 2 times, most recently from 8c9355a to 8af4881 Compare July 17, 2026 10:01
Comment thread packages/harness/src/runtime.ts
@jonathanlab
jonathanlab changed the base branch from pi-harness-runtime to graphite-base/3469 July 17, 2026 10:39
@jonathanlab
jonathanlab force-pushed the 07-15-feat_harness_integrate_pi_runtime_into_desktop_app branch from 8af4881 to 75ec760 Compare July 17, 2026 10:43
@jonathanlab
jonathanlab changed the base branch from graphite-base/3469 to pi-harness-runtime July 17, 2026 10:43
@jonathanlab
jonathanlab force-pushed the 07-15-feat_harness_integrate_pi_runtime_into_desktop_app branch from 75ec760 to dfb6df0 Compare July 17, 2026 10:44
@jonathanlab
jonathanlab changed the base branch from pi-harness-runtime to graphite-base/3469 July 17, 2026 11:16
@jonathanlab
jonathanlab force-pushed the 07-15-feat_harness_integrate_pi_runtime_into_desktop_app branch from dfb6df0 to 98059aa Compare July 17, 2026 11:18
@jonathanlab
jonathanlab changed the base branch from graphite-base/3469 to pi-harness-runtime July 17, 2026 11:18

@tatoalo tatoalo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we end up in a situation in which Pi tasks can start a competing ACP session and thus create some problems? If we are starting from the "simple" task view that's fine as well for now I guess

Comment on lines +80 to +84
await this.deps.piRunner.create({
taskId: task.id,
cwd,
prompt: input.content ?? "",
model: input.model,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we are missing the exec modes here?

jonathanlab commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Jul 20, 10:49 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 20, 10:50 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 20, 10:54 AM UTC: Graphite couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'unit-test', 'typecheck', 'upload').
  • Jul 20, 2:16 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 20, 2:16 PM UTC: @jonathanlab merged this pull request with Graphite.

@jonathanlab
jonathanlab changed the base branch from pi-harness-runtime to graphite-base/3469 July 20, 2026 10:49
@jonathanlab
jonathanlab changed the base branch from graphite-base/3469 to main July 20, 2026 10:49
@trunk-io

trunk-io Bot commented Jul 20, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@jonathanlab
jonathanlab force-pushed the 07-15-feat_harness_integrate_pi_runtime_into_desktop_app branch from 98059aa to fb86dd5 Compare July 20, 2026 10:49
@posthog

posthog Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

👋 Visual changes detected for this PR.

Review and approve in PostHog Visual Review

If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix.

@jonathanlab
jonathanlab merged commit 4f0acfb into main Jul 20, 2026
29 of 32 checks passed
@jonathanlab
jonathanlab deleted the 07-15-feat_harness_integrate_pi_runtime_into_desktop_app branch July 20, 2026 14:17
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.

2 participants