Skip to content

Commit 470ff5c

Browse files
committed
address comments
1 parent 4ef92cb commit 470ff5c

23 files changed

Lines changed: 854 additions & 795 deletions

apps/docs/content/docs/en/workflows/blocks/pi.mdx

Lines changed: 45 additions & 45 deletions
Large diffs are not rendered by default.

apps/sim/blocks/blocks/pi.ts

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ export const PiBlock: BlockConfig<PiResponse> = {
5959
description: 'Run an autonomous coding agent on a repo',
6060
authMode: AuthMode.ApiKey,
6161
longDescription:
62-
'The Pi Coding Agent runs the Pi harness against a real repository. Cloud PR spins up an isolated sandbox, clones a GitHub repo, edits with native shell + git, and opens a pull request. Cloud Code Review checks out a pinned PR snapshot with read-only tools and posts a structured review with optional inline comments. Local mode edits files on your own machine over SSH. Cloud PR and Local can reuse skills and multi-turn memory; Cloud Code Review runs without either because PR contents are untrusted.',
62+
'The Pi Coding Agent runs the Pi harness against a real repository. Create PR spins up an isolated sandbox, clones a GitHub repo, edits with native shell + git, and opens a pull request. Review Code checks out a pinned PR snapshot with read-only tools and posts a structured review with optional inline comments. Local Dev edits files on your own machine over SSH. Create PR and Local Dev can reuse skills and multi-turn memory; Review Code runs without either because PR contents are untrusted.',
6363
bestPractices: `
64-
- Use Cloud PR for hands-off changes against a GitHub repo where a reviewable PR is the deliverable.
65-
- Use Cloud Code Review to analyze an existing PR and leave summary + inline review comments.
66-
- Use Local mode to edit a repo on your own machine; expose the machine on a public hostname/tunnel so Sim can reach it over SSH.
67-
- Cloud PR requires your own provider API key because the model runs in the sandbox. Cloud Code Review keeps the model key in Sim and can use either BYOK or a hosted key.
64+
- Use Create PR for hands-off changes against a GitHub repo where a reviewable PR is the deliverable.
65+
- Use Review Code to analyze an existing PR and leave summary + inline review comments.
66+
- Use Local Dev to edit a repo on your own machine; expose the machine on a public hostname/tunnel so Sim can reach it over SSH.
67+
- Create PR requires your own provider API key because the model runs in the sandbox. Review Code keeps the model key in Sim and can use either BYOK or a hosted key.
6868
`,
6969
category: 'blocks',
7070
integrationType: IntegrationType.AI,
@@ -75,25 +75,25 @@ export const PiBlock: BlockConfig<PiResponse> = {
7575
id: 'mode',
7676
title: 'Mode',
7777
type: 'dropdown',
78-
/** Cloud modes require E2B and stay hidden when it is disabled. */
78+
/** Create PR and Review Code require E2B and stay hidden when it is disabled. */
7979
value: () => (isTruthy(getEnv('NEXT_PUBLIC_E2B_ENABLED')) ? 'cloud' : 'local'),
8080
options: () => {
8181
const options = [
8282
{
83-
label: 'Local',
83+
label: 'Local Dev',
8484
id: 'local',
8585
description: 'Edits files on your own machine over SSH',
8686
},
8787
]
8888
if (isTruthy(getEnv('NEXT_PUBLIC_E2B_ENABLED'))) {
8989
options.unshift(
9090
{
91-
label: 'Cloud PR',
91+
label: 'Create PR',
9292
id: 'cloud',
9393
description: 'Runs in an isolated sandbox, clones your repo, and opens a PR',
9494
},
9595
{
96-
label: 'Cloud Code Review',
96+
label: 'Review Code',
9797
id: 'cloud_review',
9898
description: 'Reviews an existing PR and posts GitHub review comments',
9999
}
@@ -146,7 +146,7 @@ export const PiBlock: BlockConfig<PiResponse> = {
146146
paramVisibility: 'user-only',
147147
placeholder: 'GitHub personal access token',
148148
tooltip:
149-
'Personal access token used for GitHub access. Cloud PR needs clone/push/PR permissions; Cloud Code Review needs clone + review permissions.',
149+
'Personal access token used for GitHub access. Create PR needs clone/push/PR permissions; Review Code needs clone + review permissions.',
150150
required: true,
151151
condition: CLOUD_ANY,
152152
},
@@ -200,15 +200,15 @@ export const PiBlock: BlockConfig<PiResponse> = {
200200
},
201201
{
202202
id: 'reviewEvent',
203-
title: 'Review Event',
203+
title: 'Review Outcome',
204204
type: 'dropdown',
205205
defaultValue: 'COMMENT',
206206
options: [
207207
{ label: 'Comment', id: 'COMMENT' },
208208
{ label: 'Request changes', id: 'REQUEST_CHANGES' },
209209
],
210210
tooltip:
211-
'GitHub action applied to the submitted findings. Request changes submits a changes-requested review.',
211+
'How GitHub records the submitted review. Comment is neutral; Request changes marks the pull request as changes requested.',
212212
condition: CLOUD_REVIEW,
213213
},
214214

@@ -333,6 +333,8 @@ export const PiBlock: BlockConfig<PiResponse> = {
333333
{ label: 'high', id: 'high' },
334334
{ label: 'max', id: 'max' },
335335
],
336+
tooltip:
337+
"Requested reasoning effort for Pi. Pi clamps it to the selected model's supported levels; models without reasoning run with thinking off. Higher levels usually increase latency and token cost.",
336338
mode: 'advanced',
337339
},
338340
{
@@ -400,32 +402,32 @@ export const PiBlock: BlockConfig<PiResponse> = {
400402
inputs: {
401403
mode: {
402404
type: 'string',
403-
description: 'Execution mode: cloud, cloud_review, or local',
405+
description: 'Execution mode: Create PR, Review Code, or Local Dev',
404406
},
405407
task: { type: 'string', description: 'Instruction for the coding agent' },
406408
model: { type: 'string', description: 'AI model to use' },
407-
owner: { type: 'string', description: 'GitHub repository owner (cloud modes)' },
408-
repo: { type: 'string', description: 'GitHub repository name (cloud modes)' },
409-
githubToken: { type: 'string', description: 'GitHub token (cloud modes)' },
410-
baseBranch: { type: 'string', description: 'Base branch for the PR (Cloud PR)' },
411-
branchName: { type: 'string', description: 'Branch to create (Cloud PR)' },
412-
draft: { type: 'boolean', description: 'Open the PR as a draft (Cloud PR)' },
413-
prTitle: { type: 'string', description: 'Pull request title (Cloud PR)' },
414-
prBody: { type: 'string', description: 'Pull request body (Cloud PR)' },
415-
pullNumber: { type: 'number', description: 'Pull request number (Cloud Code Review)' },
409+
owner: { type: 'string', description: 'GitHub repository owner (Create PR and Review Code)' },
410+
repo: { type: 'string', description: 'GitHub repository name (Create PR and Review Code)' },
411+
githubToken: { type: 'string', description: 'GitHub token (Create PR and Review Code)' },
412+
baseBranch: { type: 'string', description: 'Base branch for the PR (Create PR)' },
413+
branchName: { type: 'string', description: 'Branch to create (Create PR)' },
414+
draft: { type: 'boolean', description: 'Open the PR as a draft (Create PR)' },
415+
prTitle: { type: 'string', description: 'Pull request title (Create PR)' },
416+
prBody: { type: 'string', description: 'Pull request body (Create PR)' },
417+
pullNumber: { type: 'number', description: 'Pull request number (Review Code)' },
416418
reviewEvent: {
417419
type: 'string',
418420
description: 'GitHub review event: COMMENT or REQUEST_CHANGES',
419421
},
420-
host: { type: 'string', description: 'SSH host (local mode)' },
421-
port: { type: 'number', description: 'SSH port (local mode)' },
422-
username: { type: 'string', description: 'SSH username (local mode)' },
423-
authMethod: { type: 'string', description: 'SSH authentication method (local mode)' },
424-
password: { type: 'string', description: 'SSH password (local mode)' },
425-
privateKey: { type: 'string', description: 'SSH private key (local mode)' },
426-
passphrase: { type: 'string', description: 'SSH key passphrase (local mode)' },
427-
repoPath: { type: 'string', description: 'Repository path on the target (local mode)' },
428-
tools: { type: 'json', description: 'Sim tools exposed to the agent (local mode)' },
422+
host: { type: 'string', description: 'SSH host (Local Dev)' },
423+
port: { type: 'number', description: 'SSH port (Local Dev)' },
424+
username: { type: 'string', description: 'SSH username (Local Dev)' },
425+
authMethod: { type: 'string', description: 'SSH authentication method (Local Dev)' },
426+
password: { type: 'string', description: 'SSH password (Local Dev)' },
427+
privateKey: { type: 'string', description: 'SSH private key (Local Dev)' },
428+
passphrase: { type: 'string', description: 'SSH key passphrase (Local Dev)' },
429+
repoPath: { type: 'string', description: 'Repository path on the target (Local Dev)' },
430+
tools: { type: 'json', description: 'Sim tools exposed to the agent (Local Dev)' },
429431
skills: { type: 'json', description: 'Selected skills configuration' },
430432
thinkingLevel: { type: 'string', description: 'Thinking level for the model' },
431433
memoryType: { type: 'string', description: 'Memory type for multi-turn conversations' },

apps/sim/blocks/pi-model-options.test.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@ import { getProviderFromModel } from '@/providers/utils'
88
import { useProvidersStore } from '@/stores/providers/store'
99

1010
const originalBaseModels = useProvidersStore.getState().providers.base.models
11+
const originalOpenRouterModels = useProvidersStore.getState().providers.openrouter.models
1112

1213
describe('Pi model options', () => {
1314
beforeAll(() => {
14-
useProvidersStore
15-
.getState()
16-
.setProviderModels('base', ['claude-sonnet-4-6', 'claude-sonnet-4-0', 'gpt-5.4'])
15+
const store = useProvidersStore.getState()
16+
store.setProviderModels('base', ['claude-sonnet-4-6', 'claude-sonnet-4-0', 'gpt-5.4'])
17+
store.setProviderModels('openrouter', [
18+
'openrouter/openai/gpt-5',
19+
'openrouter/openrouter/fusion',
20+
])
1721
})
1822

1923
afterAll(() => {
20-
useProvidersStore.getState().setProviderModels('base', originalBaseModels)
24+
const store = useProvidersStore.getState()
25+
store.setProviderModels('base', originalBaseModels)
26+
store.setProviderModels('openrouter', originalOpenRouterModels)
2127
})
2228

2329
it("only exposes models present in Pi's pinned catalog", () => {
@@ -36,4 +42,11 @@ describe('Pi model options', () => {
3642
expect(modelIds).toContain('claude-sonnet-4-6')
3743
expect(modelIds).not.toContain('claude-sonnet-4-0')
3844
})
45+
46+
it("does not apply OpenRouter capability filters beyond Pi's catalog", () => {
47+
const modelIds = getPiModelOptions().map(({ id }) => id)
48+
49+
expect(modelIds).toContain('openrouter/openai/gpt-5')
50+
expect(modelIds).toContain('openrouter/openrouter/fusion')
51+
})
3952
})

apps/sim/executor/handlers/pi/backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface PiSkill {
2222
content: string
2323
}
2424

25-
/** SSH connection parameters for local mode (subset of the shared SSH config). */
25+
/** SSH connection parameters for Local Dev (subset of the shared SSH config). */
2626
export type PiSshConnection = Pick<
2727
SSHConnectionConfig,
2828
'host' | 'port' | 'username' | 'password' | 'privateKey' | 'passphrase'

apps/sim/executor/handlers/pi/cloud-backend.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Cloud PR backend: runs the Pi CLI inside an E2B sandbox against a cloned
2+
* Create PR backend: runs the Pi CLI inside an E2B sandbox against a cloned
33
* GitHub repo, then pushes a branch and opens a PR. Secrets are isolated per
44
* command (S2/KTD10): the GitHub token is present only for the clone and push
55
* commands (and stripped from the cloned remote), while the Pi loop runs with a
@@ -143,13 +143,13 @@ async function openPullRequest(
143143
export const runCloudPi: PiBackendRun<PiCloudRunParams> = async (params, context) => {
144144
if (!params.isBYOK) {
145145
throw new Error(
146-
'Cloud mode requires your own provider API key (BYOK). Set one in Settings > BYOK.'
146+
'Create PR requires your own provider API key (BYOK). Set one in Settings > BYOK.'
147147
)
148148
}
149149
const keyEnvVar = providerApiKeyEnvVar(params.providerId)
150150
if (!keyEnvVar) {
151151
throw new Error(
152-
`Provider "${params.providerId}" is not supported in cloud mode. Use a key-based provider or run in local mode.`
152+
`Provider "${params.providerId}" is not supported in Create PR. Use a key-based provider or run in Local Dev.`
153153
)
154154
}
155155

@@ -303,7 +303,7 @@ export const runCloudPi: PiBackendRun<PiCloudRunParams> = async (params, context
303303
return { totals, changedFiles, diff, prUrl, branch }
304304
} catch (error) {
305305
// Aborts propagate as errors so a cancelled/timed-out run is not reported as
306-
// success and no partial memory turn is persisted (local mode mirrors this).
306+
// success and no partial memory turn is persisted (Local Dev mirrors this).
307307
if (context.signal?.aborted) {
308308
logger.info('Pi cloud run aborted', { owner: params.owner, repo: params.repo })
309309
}

apps/sim/executor/handlers/pi/cloud-review-backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Cloud Code Review backend. GitHub credentials are scoped to authenticated fetch
2+
* Review Code backend. GitHub credentials are scoped to authenticated fetch
33
* and host-side review submission. The trusted Pi SDK and provider adapter use the
44
* model credential in Sim's process; neither the model context nor E2B receives it.
55
*/

0 commit comments

Comments
 (0)