Repository navigation
Conversation
Short IDs are re-derived on every `chats` run, so a short ID captured earlier (in a script, a note, or an earlier command) can stop resolving with a bare 'Short ID not found'. resolveConversationId now: - dedupes the chat index by full conversation ID before matching (the conversations API returns duplicate rows for the same thread), - falls back to unique-suffix matching (>= 4 characters, the same minimum `chats` uses) against both the short ID and the conversation-ID body, so stale short IDs and id tails still resolve, - lists the matching conversations and exits when a suffix is ambiguous (e.g. the current user's org-id tail is shared by every 1:1 thread). The resolver is exported and takes an injectable chat index for testing; covered by 9 new unit tests.
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
chatsre-derives short IDs on every run (assignShortIdspicks the shortest unique suffix per run), so a short ID captured earlier β in a script, a shell history, or an earlier command in the same session β can stop resolving with a bareShort ID 'β¦' not found, even though the conversation is right there in the index.Two aggravations in the same path:
Change
resolveConversationIdnow:chatsuses) against both the assigned short ID and the conversation-ID body β stale short IDs and id tails still resolve;:) through untouched.The function is exported and accepts an injectable chat index (
resolveConversationId(id, chats?)) for testing β no fs mocking needed.Tests
9 new unit tests in
tests/resolve-conversation-id.test.ts: passthrough, exact match, duplicate-rows dedupe, stale-short-id suffix fallback, shared-thread suffix, id-body suffix, ambiguous listing, miss exit, and the <4-char guard. 102 total, all green;biome checkandtsupbuild clean.Independent of #27 (touches a different region of
cli.ts).