Repository navigation
Sessions: parse thread suffixes by channel - #58100
Conversation
Greptile SummaryThis PR fixes a long-standing bug where Key changes:
Confidence Score: 5/5Safe to merge — the fix is targeted and well-tested, with no logic errors found across all impacted call sites. The change is a focused correctness fix that replaces a global string-scan with a channel-aware parse. All existing callers delegate to the new function and gain the fix automatically. The PR adds targeted regression tests for every affected consumer. No P0/P1 issues were found. No files require special attention. Reviews (1): Last reviewed commit: "Sessions: parse thread suffixes by chann..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
This PR updates session thread-suffix parsing so that :topic: is only treated as a thread marker for Telegram, preventing false positives for other channels (notably Feishu conversation IDs that legitimately embed :topic:).
Changes:
- Introduce
parseThreadSessionSuffix()insession-key-utilsto parse:thread:universally and:topic:only for Telegram (using a channel hint or inferred channel). - Switch thread detection/consumers (reset logic, delivery-info parsing, announce target parsing) to use the new shared parsing helper.
- Add regression tests covering Feishu embedded
:topic:and Telegram:topic:suffix behavior across key consumers.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/sessions/session-key-utils.ts | Adds channel-aware thread/topic suffix parsing and refactors parent-key resolution to use it. |
| src/routing/session-key.test.ts | Adds focused unit tests for thread suffix parsing and parent resolution (Feishu + Telegram). |
| src/config/sessions/reset.ts | Updates thread-session detection to use the shared parsing helper. |
| src/config/sessions/reset.test.ts | Adds regression tests for Feishu vs Telegram thread detection in reset logic. |
| src/config/sessions/delivery-info.ts | Reuses the shared parsing helper for extracting base/thread IDs. |
| src/config/sessions/delivery-info.test.ts | Extends delivery-info tests to cover Feishu embedded :topic: preservation. |
| src/agents/tools/sessions-send-helpers.ts | Uses shared parsing with an explicit channel hint when resolving announce targets. |
| src/agents/tools/sessions-send-helpers.test.ts | Adds a Feishu regression case for announce target parsing with embedded :topic:. |
7152a36 to
2829b9c
Compare
|
Merged via squash.
Thanks @gumadeiras! |
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: 2829b9c Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Summary
:topic::topic:suffix parsing and add regressions around announce/reset/session-key consumersTesting
pnpm test -- src/agents/tools/sessions-send-helpers.test.ts src/config/sessions/delivery-info.test.ts src/config/sessions/reset.test.ts src/routing/session-key.test.tspnpm check