Skip to content

refactor(p2c)#150

Merged
wen-placeholder merged 3 commits into
fix/studio-output-dir-validation-p2c-designfrom
wenjing0224
Feb 28, 2026
Merged

refactor(p2c)#150
wen-placeholder merged 3 commits into
fix/studio-output-dir-validation-p2c-designfrom
wenjing0224

Conversation

@wen-placeholder

Copy link
Copy Markdown
Collaborator

flatten context pack response and improve error handling. Closes #139

wen-placeholder and others added 2 commits February 28, 2026 14:34
Merges logging from fix/studio-output-dir-validation-p2c-design while
keeping structured error dict for JSON-serializable SSE response.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Feb 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch wenjing0224

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the P2C (Paper to Context) functionality by improving how errors are handled and how context pack responses are structured. The changes introduce more granular error categorization and provide a flatter, more accessible data structure for the context pack, which should simplify frontend consumption and provide clearer error feedback.

Highlights

  • Improved Error Handling: Enhanced error handling by distinguishing between client-side ValueError and general server-side Exception, providing structured error messages with 'kind' and 'message' fields.
  • Flattened Context Pack Response: Refactored the context pack response structure to merge the contents of the 'pack' directly into the top-level dictionary, simplifying access for the frontend (e.g., response.paper instead of response.pack.paper).
  • Consistent Error Streaming: Ensured that structured error messages are consistently streamed to the client when an error occurs during processing.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/paperbot/api/routes/repro_context.py
    • Added specific handling for ValueError to categorize client-side errors.
    • Modified general Exception handling to categorize server-side errors.
    • Updated error streaming to send structured error objects directly.
    • Adjusted roadmap access to reflect the flattened pack structure.
  • src/paperbot/infrastructure/stores/repro_context_store.py
    • Modified _row_to_full_dict to merge pack contents directly into the base dictionary.
    • Removed the explicit objective field from the base dictionary, as it is now included via the flattened pack.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@vercel

vercel Bot commented Feb 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
paper-bot Error Error Feb 28, 2026 1:49pm

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the paper-to-context (p2c) feature to flatten the context pack API response and improve error handling. While achieving its goal, it introduces a security risk by exposing raw exception messages to the client, potentially leading to information disclosure. I recommend sanitizing these error messages, especially for generic server-side exceptions. Additionally, I've suggested removing some redundant fields from the flattened API response to make it cleaner for clients.

I am having trouble creating individual review comments. Click here to see my feedback.

src/paperbot/api/routes/repro_context.py (129-131)

security-medium medium

The application catches generic exceptions and returns the raw exception message (str(exc)) directly to the client in the SSE stream. This can leak sensitive internal information, such as database connection details, file paths, or third-party API error messages, which could be used by an attacker to gain insights into the server's infrastructure. Generic server-side errors should return a sanitized, user-friendly message, while the detailed error should be logged internally for debugging.

@wen-placeholder
wen-placeholder merged commit c6e3207 into fix/studio-output-dir-validation-p2c-design Feb 28, 2026
3 of 4 checks passed
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.

1 participant