Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions apps/server/src/project/AgentSessionScanner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3475,6 +3475,7 @@ describe("parseAgentSessionTranscript", () => {
"<recommended_plugins>\nGitHub\n</recommended_plugins>",
"# AGENTS.md instructions for /tmp/project\n\n<INSTRUCTIONS>\nRules\n</INSTRUCTIONS>",
'<in-app-browser-context source="ambient-ui-state">\nTab\n</in-app-browser-context>',
'<external_codex_apps_open_page>{"page_id":null}</external_codex_apps_open_page>',
"Fix the import titles",
].join("\n");
const thread = AgentSessionScanner.parseAgentSessionTranscript({
Expand All @@ -3495,6 +3496,27 @@ describe("parseAgentSessionTranscript", () => {
expect(thread?.messages.map((message) => message.text)).toEqual([prompt]);
});

it.each([
"Explain <external_codex_apps_open_page> in this transcript",
"<external_codex_apps_open_page>Keep this incomplete example",
])("keeps Codex page markup that is not a complete leading block: %s", (prompt) => {
const thread = AgentSessionScanner.parseAgentSessionTranscript({
contents: [
encodeTranscriptRecord({ type: "session_meta", payload: { id: "codex-session" } }),
encodeTranscriptRecord({
type: "event_msg",
payload: { type: "user_message", message: prompt },
}),
].join("\n"),
source: "codex",
providerInstanceId: ProviderInstanceId.make("codex"),
fallbackSessionId: "fallback",
lastActiveAtMs: Date.parse("2026-08-25T08:00:00.000Z"),
});

expect(thread?.title).toBe(prompt);
});

it("skips sessions without a visible user message", () => {
const thread = AgentSessionScanner.parseAgentSessionTranscript({
contents: JSON.stringify({
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/project/AgentSessionScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ function foldClaudeFields(fields: ClaudeFields, record: DecodedTranscriptRecord)
// Codex records setup context as user text ahead of the real request. Skip
// these leading blocks when deriving a title; imported messages keep them.
const CODEX_TITLE_PREAMBLE =
/^(?:\s*(?:<(recommended_plugins|environment_context|user_instructions|INSTRUCTIONS|in-app-browser-context)(?:\s[^>]*)?>[\s\S]*?<\/\1>|# AGENTS\.md instructions\b[^\n]*|## My request for Codex:))+/;
/^(?:\s*(?:<(recommended_plugins|environment_context|user_instructions|INSTRUCTIONS|in-app-browser-context|external_codex_apps_open_page)(?:\s[^>]*)?>[\s\S]*?<\/\1>|# AGENTS\.md instructions\b[^\n]*|## My request for Codex:))+/;

// Codex appends an entry per rename; like Codex, the newest nonempty name wins.
function parseCodexThreadNames(contents: string): ReadonlyMap<string, string> {
Expand Down
Loading