Skip to content

Add OpenAI Decisions as a native System One provider - #762

Open
genglintong wants to merge 2 commits into
magpie-community:mainfrom
genglintong:feat/openai-decisions
Open

genglintong wants to merge 2 commits into
magpie-community:mainfrom
genglintong:feat/openai-decisions

Conversation

@genglintong

@genglintong genglintong commented Nov 5, 2026 •

Copy link
Copy Markdown

Magpie can use System One models as routing classifiers and decision-group
members, but OpenAI's native Decisions API uses a different path and
array-shaped questions and answers. This package exposes
openai-decisions/gpt-6-luna through the existing /v1/systemone
interface, so an existing chat group can select it as
classifier=openai-decisions/gpt-6-luna with effort=auto.

The adapter maps choice, score and noul/predicate questions and retains
structured evidence, instructions, probabilities, confidence and usage.
It preserves upstream errors, retry headers and cancellation; unsupported
requests return 400 and invalid successful upstream answers return 502.
Existing System One-compatible providers continue through Magpie's native path.

Standard API-key sign-in uses Magpie's account store. An optional explicit
method stores a reference to Magpie's enabled official openai provider
and reads its current primary key at request time. Calls use the key's
OpenAI API allowance and the fixed https://api.openai.com/v1/decisions
endpoint, with fresh headers and no redirects. The adapter does not rewrite
the saved OpenAI provider.

The package follows the community's loader layout, canonical OpenCode 2.x
bridge, MIT attribution and bilingual registry entry. The root README now
lists the provider; its package README documents released/source installation,
credential storage, classifier and decision-group setup, error/quota handling
and compatibility limits. Changelog, registry descriptions and verification
scope are synchronized. Public examples are synthetic.

Validation:

  • Node and Bun: 18 package tests pass, covering mapping, structured inputs,
    credential selection, invalid answers, errors and cancellation.
  • bun scripts/check.mjs openai-decisions: provider and registry pass.
  • Community scripts/try.sh openai-decisions: installs and lists one
    decision model in the sandbox without sign-in or OpenAI requests.
  • Package Markdown links and the JSON request example validate; the
    compatibility bridge remains byte-identical to the canonical copy.
  • Earlier real checks on Magpie 0.1.3039 returned HTTP 200 for choice/noul/score
    through OpenAI and TypeSafe, and for their shared decision group. A real
    OpenAI classifier call was recorded as kind=routing, HTTP 200, before
    the downstream chat completed with OK. This documentation follow-up
    does not change the runtime or repeat live quota-consuming checks.

The full community test suite was not run locally and remains an upstream
CI requirement. Live OpenCode decision workflows and Windows/Linux execution
are not verified. Limits and real-check scope are in
packages/openai-decisions/VERIFICATION.md.

Related: yetone/magpie#4316.

Latest locally verified head: ba568b4f02bac32f7fa4640a3344b5518d562260.

Add the provider to the repository README and synchronize its package README,
English/Chinese registry summaries, changelog and verification scope. Explain
released/source installation, native decision-group/classifier setup, credential
storage, shared OpenAI API allowance and quota/error handling.

Runtime modules, dependencies and the initial unpublished 0.1.0 version are
unchanged. Follow the community README's layout and loader conventions; keep
the canonical OpenCode bridge untouched. Related PR: magpie-community#762.

Verification on this tree:
- npm test in packages/openai-decisions: 18 pass, 0 fail.
- Bun package tests: 18 pass, 0 fail.
- bun scripts/check.mjs openai-decisions: registry and provider pass.
- scripts/try.sh openai-decisions with Magpie 0.1.3039: sandbox installation
  and unsigned provider listing pass, one model, no vendor call.
- Documentation checks: six local links and one JSON request example pass;
  registry descriptions and local source docs match; bridge is identical.
- git diff --check and credential/private-data scan pass.

No live model requests were made for this documentation follow-up. The full
community suite was not run locally; upstream CI remains required. Live
OpenCode decision workflows and Windows/Linux execution remain unverified.
@yetone

yetone commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Thanks — the adapter is careful work: the request/answer mapping matches OpenAI's create-decision reference, the only outbound address is api.openai.com/v1/decisions, and the tests stay offline (18/18 on Bun and Node, whole-repo check and bun test green on our box at ba568b4). A few things before we can merge:

  1. Please drop the "use the OpenAI key already saved in Magpie" method (credentials.mjs, index.mjs:27-34). Plugins shouldn't read magpie's providers.json, which holds every provider's key; direct API-key sign-in covers the need. (As written it also looks in %APPDATA% on Windows, where magpie uses ~/.config/magpie, and magpie's GUI ignores keyless, so it would still ask for a key.)
  2. OpenAI can answer a single question with {"type":"refusal"} while answering the others. adapter.mjs:105 turns that into a 502 for the whole request; please leave a refused question out of answers (or mark it) instead.
  3. instructions is required upstream; adapter.mjs:23 sends "" when System One gives none. Please reject locally or send a non-empty default.
  4. Rebase on main (registry.json conflicts) and keep the registry entry on one line like its neighbours.
  5. Rename the package to @magpie-community/opencode-openai-decisions-auth to match the other provider packages, and use an https/data: icon in package.json (magpie ignores "openai" there).
  6. Small: the test creates .data/ in the working directory (use os.tmpdir()), code comments in English please, and please drop the third-party repo link from README/NOTICE.

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