[pull] main from danny-avila:main - #159
Merged
Merged
Conversation
…#382) CODE_ARTIFACT_PATH_GUIDANCE buried the multi-call persistence rule in a trailing clause, listed only ten data-format extensions, and called everything else "odd extensions". Models kept writing helper files to /tmp and reading them a call later despite the docs (observed in production), and the narrow list wrongly implied source files such as .py helper modules do not persist, when the code API's output filter accepts all common source, text, data, document, image, and archive formats. The guidance now leads with the imperative rule (write anything a later call needs under /mnt/data in the same call that produces it), gives representative extension examples grounded in the actual filter, and defines the unrecognized-extension behavior explicitly.
…xtraction (#380) getCacheWriteTokens/attachCacheWriteMetadata read usage.input_tokens_details.cache_write_tokens with only the first `?.` optional — safe against OpenAI itself (which always populates input_tokens_details), but any OpenAI-*compatible* server that omits it (e.g. mlx_vlm.server and other local/self-hosted backends) threw "Cannot read properties of undefined (reading 'cache_write_tokens')" on every single completion. ResponsesUsageWithCacheWrite's plain intersection with the SDK's ResponseUsage type was part of why this slipped past review: the SDK declares input_tokens_details required, so the intersection kept it required despite the local `?:` redeclaration, which is also why a bare `?.` add-on trips @typescript-eslint/no-unnecessary-condition. Switched to the same Omit-then-redeclare pattern this file already uses for CompletionUsageWithCacheWrite (the analogous Completions API field), so the type honestly reflects that this field is genuinely optional for non-OpenAI backends. Exported the three helpers (previously module-private) for direct unit test coverage; added cacheWriteTokens.test.ts covering the missing-field, missing-usage, and field-present cases for all three.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )