Merge pull request #64 from grp06/codex/investigate-double-messages

Strip timestamp envelopes to collapse duplicate user messages
This commit is contained in:
George Pickett
2026-02-17 15:47:20 -08:00
committed by GitHub
3 changed files with 26 additions and 2 deletions
+1 -1
View File
@@ -539,7 +539,7 @@ export const stripUiMetadata = (text: string) => {
cleaned = cleaned.replace(PROJECT_PROMPT_BLOCK_RE, "");
}
cleaned = cleaned.replace(MESSAGE_ID_RE, "").trim();
return cleaned;
return stripEnvelope(cleaned);
};
export const isHeartbeatPrompt = (text: string) => {
+1 -1
View File
@@ -104,7 +104,7 @@ describe("message-extract", () => {
[Thu 2026-02-12 01:14 UTC] nope none of those are it. keep looking
[message_id: e050a641-aa32-4950-8083-c3bb7efdfc6d]`;
expect(stripUiMetadata(raw)).toBe("[Thu 2026-02-12 01:14 UTC] nope none of those are it. keep looking");
expect(stripUiMetadata(raw)).toBe("nope none of those are it. keep looking");
});
it("hides internal exec approval auto-resume messages from transcript text", () => {
+24
View File
@@ -511,4 +511,28 @@ Continue where you left off and finish the task.`,
historyLoadedAt: 400,
});
});
it("collapses optimistic user lines when history carries a post-system timestamp envelope", () => {
const patch = buildHistorySyncPatch({
messages: [
{
role: "user",
timestamp: "2026-02-17T23:39:00.000Z",
content:
"System: [2026-02-17 23:38 UTC] queued\n\n[Tue 2026-02-17 23:39 UTC] Ask me some questions",
},
],
currentLines: ["> Ask me some questions"],
loadedAt: 500,
status: "idle",
runId: null,
});
expect(patch).toEqual({
outputLines: ['[[meta]]{"role":"user","timestamp":1771371540000}', "> Ask me some questions"],
lastResult: null,
lastUserMessage: "Ask me some questions",
historyLoadedAt: 500,
});
});
});