Repository navigation
fix(core): preserve OMP reasoning and add host protocol contracts #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: Latest host compatibility | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "43 7 * * 1" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| latest: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: npm | ||
| - uses: oven-sh/setup-bun@v2.2.0 | ||
| with: | ||
| bun-version: 1.4.0 | ||
| - run: npm ci | ||
| - name: Install latest hosts (separate from pinned PR gates) | ||
| run: | | ||
| npm install -g @earendil-works/pi-coding-agent@latest @oh-my-pi/pi-coding-agent@latest | ||
| echo "PI_BIN=$(npm prefix -g)/bin/pi" >> "$GITHUB_ENV" | ||
| echo "OMP_BIN=$(npm prefix -g)/bin/omp" >> "$GITHUB_ENV" | ||
| - name: Record versions | ||
| run: | | ||
| { "$PI_BIN" --version; "$OMP_BIN" --version; node --version; bun --version; } | tee -a "$GITHUB_STEP_SUMMARY" | ||
| - run: npm test | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On its own this job fails silently into the Actions tab (no issue, no notification beyond the default email). Fine if #163 lands; if this merges without it, note in CONTRIBUTING that someone has to look at the weekly run. |
||
| env: | ||
| PI_LOCAL_REQUIRED: "1" | ||
| OMP_COMPAT_REQUIRED: "1" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,9 @@ | |
|
|
||
| ## Unreleased | ||
|
|
||
| - Preserve Chat Completions reasoning history on OMP with an explicit replay compatibility flag, verified by real Pi/OMP follow-up requests rather than only visible thinking deltas. | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "verified by real Pi/OMP follow-up requests rather than only visible thinking deltas" is verification detail for the PR, not a user-facing note. Suggest: "Preserve Chat Completions reasoning history on OMP; previous reasoning was dropped from follow-up requests." |
||
| - Add shared mock protocol contracts for reasoning, system prompts, parallel tools and image results across Chat Completions, Responses and Anthropic Messages, including packed-package checks. Pin supported hosts in PR CI and check latest hosts weekly. Allow explicit multi-model live profiles without enabling paid CI calls. | ||
|
|
||
| ## 0.7.8 - 2026-10-15 | ||
|
|
||
| - Redact sensitive text in direct stream errors and normalized context-overflow messages before returning them to the host. This closes two error-reporting paths that did not use the shared redactor; it is defensive hardening, not a claim of a confirmed credential leak ([#155](https://github.com/patlux/pi-commandcode-provider/pull/155)). | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,7 +111,11 @@ function commandCodeHeaders(): Record<string, string> | undefined { | |
| */ | ||
| type CommandCodeProviderConfig = ProviderConfig & { usage?: UsageProvider } | ||
|
|
||
| type CommandCodeModelCompat = NonNullable<ProviderConfig["models"]>[number]["compat"] | ||
| // OMP requires an explicit opt-in to replay Chat Completions reasoning. | ||
| // Pi preserves the streamed signature itself and ignores this extra flag. | ||
| type CommandCodeModelCompat = NonNullable<ProviderConfig["models"]>[number]["compat"] & { | ||
| replayReasoningContent?: boolean | ||
| } | ||
|
|
||
| /** | ||
| * Compatibility flags per wire. Chat Completions mirrors what the Provider API | ||
|
|
@@ -140,6 +144,7 @@ function compatForModel(model: CommandCodeModel): CommandCodeModelCompat { | |
| supportsStore: false, | ||
| supportsDeveloperRole: false, | ||
| supportsReasoningEffort: MODEL_EFFORTS[model.id] !== undefined, | ||
| replayReasoningContent: model.reasoning, | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This flag is now also sent to Pi. The comment says Pi ignores it — a link to the OMP flag definition (or a one-line note on which OMP version introduced it) would make the "OMP requires explicit opt-in" claim verifiable later when either host changes behavior. |
||
| maxTokensField: "max_tokens", | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /** Deterministic test tools. No filesystem or network access. */ | ||
| interface FixtureTool { | ||
| name: string | ||
| label: string | ||
| description: string | ||
| parameters: unknown | ||
| execute: ( | ||
| id: string, | ||
| args: { image?: string | null }, | ||
| ) => Promise<{ | ||
| content: ({ type: "text"; text: string } | { type: "image"; data: string; mimeType: string })[] | ||
| details: undefined | ||
| }> | ||
| } | ||
| interface FixtureApi { | ||
| registerTool(tool: FixtureTool): void | ||
| } | ||
|
|
||
| export default function (pi: FixtureApi) { | ||
| pi.registerTool({ | ||
| name: "contract_read", | ||
| label: "Contract read", | ||
| description: "Return a synthetic image and text for protocol contract tests", | ||
| parameters: { | ||
| type: "object", | ||
| properties: { image: { type: ["string", "null"] } }, | ||
| required: ["image"], | ||
| }, | ||
| async execute(_id, args) { | ||
| return { | ||
| content: [ | ||
| { type: "text", text: `contract-result-${args.image}` }, | ||
| { | ||
| type: "image", | ||
| data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jRZkAAAAASUVORK5CYII=", | ||
| mimeType: "image/png", | ||
| }, | ||
| ], | ||
| details: undefined, | ||
| } | ||
| }, | ||
| }) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinning Pi to 1.1.0 is a coverage regression: 1.2.0 (2026-10-12) and 1.3.0 (2026-10-15, published before this PR was opened) are out, and CI previously tested
@latest. A PR that breaks on 1.3.0 now merges green and only shows up in the weekly job, after the fact.Suggest:
latestjob withcontinue-on-error: truein PR CI, so drift is visible on the PR rather than a week later.Either way, CONTRIBUTING should say who bumps the pin and when (a green
Latest host compatibilityrun should be the trigger).