Skip to content

fix(server): recover assistant text when completion extends a prefix - #77

Closed
macodev00 wants to merge 1 commit into
mainfrom
cursor/codex-completion-prefix-redo2-28b6
Closed

macodev00 wants to merge 1 commit into
mainfrom
cursor/codex-completion-prefix-redo2-28b6

Conversation

@macodev00

@macodev00 macodev00 commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Problem

Codex can finish an assistant item with the full reply in item.completed while T3 has only persisted a prefix such as Hi! I. Finalization kept that prefix and marked the message complete, so refresh could not recover the rest.

A completion snapshot that adds only whitespace, such as a trailing newline, hits the same gap. The suffix has no renderable characters of its own, so the persisted message stays shorter than the snapshot.

Change

When item.completed detail strictly extends text already accumulated (projected plus still buffered), ingestion persists only the missing suffix. That includes a whitespace-only suffix once the message already has text. Equal, empty, and divergent snapshots keep the streamed text. A snapshot that is only whitespace leaves the thread without a new assistant message.

Fixes pingdotgg#13436
Supersedes pingdotgg#13583

Scope and approval

Maintainer confirmation of the failure and the reconciliation rules is on pingdotgg#13436. This replaces pingdotgg#13583, which left the whitespace-only suffix unresolved.

Verification

From apps/server at commit 4d0d98ed1, Node 24.13.1, Linux x64:

vp test run src/orchestration/Layers/ProviderRuntimeIngestion.test.ts

Result: Test Files 1 passed (1), Tests 97 passed (97). Duration 5.50s.

That run covers the new cases: a buffered prefix, an already projected prefix, a flushed paragraph plus a buffered remainder, a whitespace-only suffix (Hello completed as Hello\n), a whitespace-only snapshot with no prior text, and a divergent snapshot. uses assistant item completion detail when no assistant deltas were streamed still passes.

vp run typecheck

Result: tsc --noEmit exited 0. It printed five pre-existing suggestions in unrelated files (CodexInstallation.ts, CodexAdapter.test.ts, CodexProvider.ts, ws.ts) and no errors in the files this PR changes.

Limitations

Checked on Linux x64 with Node 24.13.1 only. Not run on Windows, and not against a live Codex app-server.

Grok 4.7 via Cursor.

Open in Web Open in Cursor 

item.completed detail is a full snapshot. A nonempty buffered or already
projected prefix was kept and the rest of the reply was dropped. When detail
strictly extends that accumulated text, persist only the missing suffix,
including a suffix that is only whitespace.
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Oct 2, 2026
@macodev00

Copy link
Copy Markdown
Owner Author

Opened upstream.

@macodev00 macodev00 closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Codex custom-provider replies truncated despite full text in item/completed

1 participant