feat: enforce max constraints on image generation limits#86
feat: enforce max constraints on image generation limits#86
Conversation
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
AgentSeal
left a comment
There was a problem hiding this comment.
Nice fix, solid defense-in-depth across all three layers (CLI, Web API, MCP). Two small things we noticed:
- CLI height check missing
sys.exit(1)-- incli.py, the steps and width checks both callsys.exit(1)afterlog_error, but the height check just falls through:
if args.height > max_height:
log_error(f"Requested height ({args.height}) exceeds the maximum allowed ({max_height}).")
# missing sys.exit(1) here- MCP schema-level enforcement -- the
Field()annotations add descriptions but nole=constraint. Addingle=4096(orle=max_steps/max_width/max_height) would let MCP hosts reject invalid values at the schema validation layer before the tool handler runs:
steps: int = Field(default=9, le=50, description="Number of inference steps")
width: int = Field(default=1280, le=4096, description="Image width in pixels")
height: int = Field(default=720, le=4096, description="Image height in pixels")Not a blocker since the server-side ValueError catches it, but schema-level enforcement is the strongest signal to agents and hosts.
Everything else looks good. Will rescan once this lands.
Fixes an issue where unbounded height, width, and step parameters could lead to runaway resource utilization.
max_steps,max_width, andmax_heightare stored in config filezimg infoand web UI/infoendpointsPR created automatically by Jules for task 7463793138972359175 started by @iconben