fix(auto-reply): pass topicId when cleaning up transcript after session reset#52782
fix(auto-reply): pass topicId when cleaning up transcript after session reset#52782kevinWangSheng wants to merge 1 commit into
Conversation
…on reset When a session is reset due to role ordering conflict with cleanupTranscripts enabled, the code deletes the old transcript file. However, resolveSessionTranscriptPath was called without the MessageThreadId parameter, producing a path without the topic suffix. For Telegram forum topic sessions (where MessageThreadId is set), this means the cleanup targets a non-existent path while the actual transcript file (with topic suffix) is left behind. The new-session creation path (line 320-324) correctly passes sessionCtx.MessageThreadId. Align the cleanup path to match. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Greptile SummaryThis PR fixes a stale-transcript leak for Telegram forum-topic sessions. When a session is reset after a role-ordering conflict, the cleanup code was calling
Confidence Score: 5/5
Reviews (1): Last reviewed commit: "fix(auto-reply): pass topicId when clean..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eabeb72cde
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| transcriptCandidates.add( | ||
| resolveSessionTranscriptPath(prevSessionId, agentId, sessionCtx.MessageThreadId), |
There was a problem hiding this comment.
Use persisted thread id when cleaning reset transcripts
For restored thread/topic sessions, dispatch-from-config.ts:221-222 can intentionally leave ctx.MessageThreadId empty and recover the thread from the sessionKey, and session.ts:413-425 persists that value on lastThreadId. This cleanup path now only consults sessionCtx.MessageThreadId, so in those flows it still falls back to the non-thread transcript name. If prevEntry.sessionFile is missing or stale (the legacy case this patch is trying to cover), a role-ordering reset will still leave the real *-topic-*.jsonl transcript behind for slash/ACP/restored thread sessions.
Useful? React with 👍 / 👎.
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open. The PR points at a real topic-scoped transcript cleanup bug, but the branch now edits an obsolete inline cleanup site while current main routes resets through Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. So I’m closing this here because the remaining work is already tracked in the canonical issue. Review detailsBest possible solution: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. Do we have a high-confidence way to reproduce the issue? Yes, source-level. Current main's reset helper still resolves the cleanup fallback without any topic id while session creation can write topic-qualified transcript paths from active metadata or the parsed session key. Is this the best way to solve the issue? No. The branch edits the old inline cleanup site; the maintainable fix belongs in Security review: Security review cleared: The diff only changes a local transcript path argument and does not touch dependencies, workflows, package metadata, permissions, downloaded code, or secrets. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 996d07ee466c. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
ClawSweeper applied the proposed close for this PR.
|
Summary
cleanupTranscripts: true), the cleanup code callsresolveSessionTranscriptPath(prevSessionId, agentId)without thetopicIdparametersessionCtx.MessageThreadIdas the third argumentRoot cause
The
resolveSessionTranscriptPathfunction accepts an optionaltopicIdparameter that appends a topic-specific suffix to the transcript file path. The session-creation code passessessionCtx.MessageThreadId, but the cleanup code (line 352) omits it, producing a different path than the one actually written to disk.Fix
Pass
sessionCtx.MessageThreadIdto the cleanup call at line 352, matching the pattern used at lines 320-324 for creating the new session transcript path.Test plan
MessageThreadIdis undefined)🤖 Generated with Claude Code