[codex] Preserve system prompts for Gemma templates#992
[codex] Preserve system prompts for Gemma templates#992mimeding wants to merge 5 commits intoosaurus-ai:mainfrom
Conversation
2d27be1 to
ed5d6bc
Compare
|
@mimeding this doesn't feel like a fix to me, as it introduces 1-off case related to a specific model. the fix should belong to https://github.com/osaurus-ai/vmlx-swift-lm, currently maintained by @jjang-ai . |
|
You are right, thanks for calling this out. I checked the net diff here and this PR is adding an Osaurus-side Gemma-only compatibility shim in I also checked |
ed5d6bc to
599e29e
Compare
|
Follow-up implemented in the dependency repo: osaurus-ai/vmlx-swift-lm#1 I moved the fix out of Osaurus and into That PR also includes the CI/package fixes needed for clean validation in a fresh public checkout:
Local validation on the upstream branch is green via I would treat this Osaurus PR as blocked/superseded by the upstream PR for now. Once the vmlx PR lands, the Osaurus-side follow-up should be just a dependency bump plus a small regression test if the integration surface still needs it. |
Business rationale: Gemma-family local templates need system prompts preserved after the current thinking-content contract landed, otherwise the trust-building prompt harness regresses during rebase even when CI previously passed. Coding rationale: Preserve the existing Gemma system-preamble shim, pass through the new reasoning_content field when rebuilding the first user message, and limit style fixes to ModelRuntime.swift so touched-file lint can run cleanly without broad refactors. Co-authored-by: Codex <codex@openai.com>
599e29e to
8c402ff
Compare
Business rationale
Gemma-family local templates have historically handled
systemrole messages unevenly, which can silently drop the user's configured instructions when they run local models. Preserving those instructions strengthens the prompt harness and keeps local model behavior predictable across template variants, especially for users who rely on system prompts for business context, safety boundaries, or coding conventions.Coding rationale
The compatibility shim stays narrowly scoped to Gemma-family local models instead of changing the global chat-message path. System content is mirrored into the first user turn and standalone system messages are removed only for affected templates, preserving the normal OpenAI-style role layout everywhere else. The rebase preserves
reasoning_contentwhen rebuilding the first user message so the branch remains compatible with the current thinking-content contract. Touched-file style fixes stay insideModelRuntime.swiftso strict lint can run cleanly without broad service refactors.What changed
reasoning_contentfield.ModelRuntime.swiftso strict formatter and SwiftLint gates pass.Validation
git fetch origin && git rebase origin/main- passed after resolving the.github/workflows/ci.ymlcomment conflict against main's current DerivedData cache behavior.swift build --package-path Packages/OsaurusCore- passed.swift build --package-path Packages/OsaurusCore -c release- passed.swift test --package-path Packages/OsaurusCore- passed: 1,439 tests in 193 suites, with sandbox integration tests skipped by their normal environment gate.xcrun swift-format lint --stricton every touched Swift file - passed.swiftlint lint --stricton every touched Swift file - passed file-by-file.git diff --check origin/main...HEAD- passed.Packages/OsaurusCLI.Non-scope
Residual risks
The shim intentionally duplicates system instructions into user-visible prompt text for affected local templates. If future Gemma templates gain reliable native
systemrole handling, this compatibility path should be revisited so the model does not receive redundant instruction framing.