fix(codex): accept prepared chat attachments with model overrides

This commit is contained in:
2026-10-20 18:06:11 +01:00
parent 83fef10331
commit 68761652cf
8 changed files with 383 additions and 16 deletions
+13 -2
View File
@@ -89,10 +89,21 @@ func (c *Chat) Prompt(ctx context.Context, id, text string) error {
// PromptFile is one local file handed to OpenCode with a prompt. URI is the
// file:// URL the server wrote; Name is the browser's display name.
type PromptFile struct {
URI string
Name string
URI string
Name string
preparedURI string
}
// NewPreparedPromptFile marks a file written by the server attachment store.
// Only trusted server-side upload preparation should call this constructor;
// browser-provided paths must never be marked as prepared.
func NewPreparedPromptFile(uri, name string) PromptFile {
return PromptFile{URI: uri, Name: name, preparedURI: uri}
}
// ServerPrepared reports whether URI is the unchanged server-prepared reference.
func (f PromptFile) ServerPrepared() bool { return f.URI != "" && f.URI == f.preparedURI }
// PromptWithMessageID forwards the caller's canonical message id to OpenCode.
// OpenCode persists this id in history, which is the only safe bridge between
// the live user echo and an authoritative history page.