Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 28, 2025

This PR addresses an issue where secondary sessions (sessionIndex > 0) were not attempting to retrieve problem statements from request turn messages, unlike initial sessions which already had this functionality.

Problem

Previously, only the initial session (sessionIndex === 0) would try to fetch problem statements from the Jobs API using getJobBySessionId(). Secondary sessions would only look at timeline events (comments/reviews) for prompts, missing potentially valuable problem statement context that could improve the session's understanding of the user's intent.

Solution

Enhanced the getFollowUpSessionPrompt() method to mirror the problem statement retrieval logic from getInitialSessionPrompt():

  1. Added Jobs API call - Secondary sessions now first attempt to retrieve problem statements via capi.getJobBySessionId()
  2. Consistent title extraction - Uses the same TITLE regex pattern (/TITLE: \s*(.*)/i) to extract meaningful prompts from problem statements
  3. Graceful fallback - If no problem statement is found, the existing timeline event-based logic is preserved
  4. Enhanced logging - Added appropriate logging to track when problem statements are found for secondary sessions

Changes Made

  • Modified getFollowUpSessionPrompt() method signature to accept session, pullRequest, and capi parameters
  • Added problem statement retrieval logic at the beginning of the method
  • Updated the call in determineSessionPrompt() to pass the required parameters
  • Added comprehensive test coverage for the title extraction functionality

Backward Compatibility

This change is fully backward compatible. The existing timeline event-based fallback logic remains unchanged, ensuring that secondary sessions continue to work as before when no problem statement is available.

The enhancement follows the established pattern from initial session handling, maintaining code consistency and ensuring that all sessions now have equal access to problem statement context.

Created from VS Code via the GitHub Pull Request extension.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

… API

Co-authored-by: rebornix <876920+rebornix@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Enhancing Secondary Sessions with Problem Statement Retrieval Enhance secondary sessions with problem statement retrieval from Jobs API Jul 28, 2025
@Copilot Copilot AI requested a review from rebornix July 28, 2025 16:00
Copilot finished work on behalf of rebornix July 28, 2025 16:00
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rebornix, is this still something we want to do?

@alexr00
Copy link
Member

alexr00 commented Oct 9, 2025

Closing, feel free to reopen!

@alexr00 alexr00 closed this Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants