Merge pull request #143 from sooth/codex/repl-memory-and-schema-hardening

[codex] fix: trim persisted tool results and sanitize MCP schemas
This commit is contained in:
Kevin Codex
2026-04-02 21:41:30 +08:00
committed by GitHub
10 changed files with 449 additions and 26 deletions

View File

@@ -39,6 +39,7 @@ import {
resolveProviderRequest,
} from './providerConfig.js'
import { redactSecretValueForDisplay } from '../../utils/providerProfile.js'
import { sanitizeSchemaForOpenAICompat } from './openaiSchemaSanitizer.js'
const GITHUB_MODELS_DEFAULT_BASE = 'https://models.github.ai/inference'
const GITHUB_API_VERSION = '2022-11-28'
@@ -270,11 +271,7 @@ function normalizeSchemaForOpenAI(
schema: Record<string, unknown>,
strict = true,
): Record<string, unknown> {
if (!schema || typeof schema !== 'object' || Array.isArray(schema)) {
return (schema ?? {}) as Record<string, unknown>
}
const record = { ...schema }
const record = sanitizeSchemaForOpenAICompat(schema)
if (record.type === 'object' && record.properties) {
const properties = record.properties as Record<string, Record<string, unknown>>