fix: scope show-prompt --commit output to the specified commit's timeframe#882
Open
fix: scope show-prompt --commit output to the specified commit's timeframe#882
Conversation
…frame When --commit is specified, truncate the resolved message transcript to only include messages whose timestamps are at or before the commit's author-date. This fixes the bug where show-prompt returned the full session transcript regardless of which commit was specified. Closes #861 Co-Authored-By: Sasha Varlamov <sasha@sashavarlamov.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
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.
Summary
Fixes #861. When
--commitis specified ongit-ai show-prompt, the command now truncates the resolved message transcript to only include messages whose RFC-3339 timestamps are at or before the commit's author-date. Previously, the full session transcript was returned regardless of which commit was specified.How it works: A new
truncate_messages_to_commit()function reads the commit's author timestamp, then walks the message list and cuts it off at the first message whose timestamp exceeds the commit time. Messages without timestamps are preserved (we can't prove they're beyond the cutoff). This is applied after message resolution (CAS/SQLite) and only when--commitis provided.Review & Testing Checklist for Human
if !msgs_first.is_empty() && !msgs_second.is_empty()— since the test environment doesn't inject timestamped messages into CAS/SQLite, both arrays are likely empty, meaning the truncation logic is never actually exercised by the test. Verify whether the test provides meaningful coverage or is just a smoke test.truncate_messages_to_commitfails (e.g., commit metadata can't be read), the full untruncated transcript is returned silently due to thelet Ok(truncated) = ...pattern. Confirm this is the desired behavior vs. surfacing an error.git-ai show-prompt <id> --commit <first_sha>andgit-ai show-prompt <id> --commit <second_sha>, and verify the message counts differ appropriately.Notes
chronocrate was already a dependency; no new packages added.clippy) and format (cargo fmt) checks pass locally.Link to Devin session: https://app.devin.ai/sessions/27660bd018284aceb8d275a617195891
Requested by: @svarlamov