Add native image generation harness tools - #20
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a3c4b6dac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| tool = declared_tool or ("imagegen / image_gen" if evidence else None) | ||
| models = model_declarations.get(key, ["provider-default"] if tool else []) | ||
| available = bool(command_path and tool) |
There was a problem hiding this comment.
Verify tool availability before auto-routing
When a harness CLI and a matching skill file are installed but the provider does not expose the underlying image tool for the current account or execution surface, this marks the harness as available anyway. The bundled image-generation skill itself accounts for the built-in tool being unavailable, so skill presence is not capability proof; image auto can consequently select this false positive ahead of a genuinely capable harness and fail without producing an artifact. Probe the actual tool capability, or treat skill-only evidence as unknown and exclude it from automatic routing.
Useful? React with 👍 / 👎.
| ".png": header.startswith(b"\x89PNG\r\n\x1a\n"), | ||
| ".jpg": header.startswith(b"\xff\xd8\xff"), | ||
| ".jpeg": header.startswith(b"\xff\xd8\xff"), | ||
| ".webp": header.startswith(b"RIFF") and header[8:12] == b"WEBP", | ||
| ".gif": header.startswith((b"GIF87a", b"GIF89a")), |
There was a problem hiding this comment.
Reject truncated images instead of checking only magic bytes
When a generator leaves a truncated or corrupt file whose first bytes still contain the expected signature, validate_image_artifact returns success and the job is reported as finished. For example, a PNG header followed by arbitrary bytes passes this table even though no image decoder can open it, allowing the supposedly verified raster artifact to be handed to the implementation worker. Validate the complete container structure or decode the image before reporting success.
Useful? React with 👍 / 👎.
What changed
second-opinion image-toolsfor machine-readable image capability and generator discoverysecond-opinion imagefor native-harness image creation and editing with references, model controls, background task management, and verified raster artifactsWhy
User feedback called out that visual redesigns were being passed directly to an implementation LLM and looked overly generated. This adds a first-class visual concept step: an orchestrator can use an available native image model/tool to create a real reference artifact, inspect it, and then hand that artifact to the best implementation worker.
Safety and performance
Second Opinion does not call image APIs, install generators, or handle image credentials. Output stays inside the selected workspace, existing artifacts require
--force, and success requires a created or updated raster file with a valid signature. Validation reads only a fixed 16-byte header.Verification
python3 -m py_compile bin/second-opinionpython3 -m unittest discover -s tests -v(40 tests)image-toolsandimage --dry-runruff check bin/second-opinion tests/test_cli.pygit diff --check