Skip to content

Add runtime extra instruction files to pvmap generator prompt#1972

Open
rohitkumarbhagat wants to merge 1 commit intodatacommonsorg:masterfrom
rohitkumarbhagat:a12n-extra-instruction-files
Open

Add runtime extra instruction files to pvmap generator prompt#1972
rohitkumarbhagat wants to merge 1 commit intodatacommonsorg:masterfrom
rohitkumarbhagat:a12n-extra-instruction-files

Conversation

@rohitkumarbhagat
Copy link
Copy Markdown
Contributor

Summary

  • add --extra_instruction_files and --extra_instruction_max_bytes to pvmap_generator.py
  • validate extra instruction files before prompt generation
  • pass absolute extra-instruction file paths into the rendered prompt
  • update the prompt to read extra instruction files when present, with clear conflict preference
  • add a final execution reminder for extra instruction files

@rohitkumarbhagat rohitkumarbhagat enabled auto-merge (squash) April 20, 2026 18:47
@rohitkumarbhagat rohitkumarbhagat requested a review from ajaits April 20, 2026 18:47
Copy link
Copy Markdown
Contributor

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

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 introduces the ability to provide extra instruction files to the Gemini agent during the PVMap generation process. It includes new configuration flags, validation logic for file size and encoding, and updates to the prompt template to incorporate these instructions. Feedback was provided regarding the enforcement of working directory boundaries for these extra files to ensure they are accessible when sandboxing is enabled.

Comment on lines +231 to +233
def _validate_extra_instruction_file(self, path: str) -> Path:
"""Resolve and validate an extra instruction file."""
resolved_path = self._resolve_path(path)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The _validate_extra_instruction_file method uses _resolve_path which allows files outside the working directory. However, if enable_sandboxing is set to True (which is the default on macOS), the Gemini agent running in the sandbox will likely be restricted to the working directory and will fail to read these extra instruction files at runtime.

To ensure the agent can actually access these files, consider enforcing the same working directory boundary as input_data and input_metadata by using _validate_and_convert_path instead of _resolve_path.

Suggested change
def _validate_extra_instruction_file(self, path: str) -> Path:
"""Resolve and validate an extra instruction file."""
resolved_path = self._resolve_path(path)
def _validate_extra_instruction_file(self, path: str) -> Path:
"""Resolve and validate an extra instruction file."""
resolved_path = self._validate_and_convert_path(path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pls check if Gemini suggestion for sandbox mode should be supported

file_size = resolved_path.stat().st_size
max_bytes = self._config.extra_instruction_max_bytes
if file_size > max_bytes:
raise ValueError(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we truncate file with a warning rather than terminate program or in future summarize the file to fit in size threshold?

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.

2 participants