fix(nano-banana-pro): remove space after MEDIA: token#18706
fix(nano-banana-pro): remove space after MEDIA: token#18706vincentkoc merged 1 commit intoopenclaw:mainfrom
Conversation
…ge.py The MEDIA: output token must appear at line start with no space after the colon for OpenClaw's splitMediaFromOutput parser to extract the file path and auto-attach media on outbound chat channels (Discord, Telegram, WhatsApp, etc.). The script was printing 'MEDIA: /path' (with space), which while tolerated by the regex, does not match the canonical 'MEDIA:/path' format used by all other skills (e.g. openai-image-gen) and tested in the codebase (pi-embedded-subscribe.tools.media.test.ts, media/parse.test.ts). Also updated the comment to clarify the format constraint.
There was a problem hiding this comment.
Pull request overview
Aligns the nano-banana-pro skill’s stdout media directive with the repo’s canonical MEDIA:<path> format so downstream media extraction and consumers see consistent output.
Changes:
- Remove the space after
MEDIA:when printing the generated image path. - Update the inline comment to document the expected
MEDIA:line format.
| # OpenClaw parses MEDIA: tokens (line-start, no space after colon) | ||
| # and will attach the file on supported chat providers. |
There was a problem hiding this comment.
The new comment implies OpenClaw’s parser requires “no space after colon”, but the parser is whitespace-tolerant (e.g. MEDIA_TOKEN_RE = /\bMEDIA:\s*/ in src/media/parse.ts, and tests cover MEDIA: ./image.png). Consider rewording this comment to describe the canonical output format (prefer MEDIA:<path>), rather than a strict parsing constraint.
| # OpenClaw parses MEDIA: tokens (line-start, no space after colon) | |
| # and will attach the file on supported chat providers. | |
| # OpenClaw parses MEDIA: tokens and will attach the file on supported chat providers. | |
| # This script emits the canonical MEDIA:<path> format. |
| # OpenClaw parses MEDIA: tokens (line-start, no space after colon) | ||
| # and will attach the file on supported chat providers. | ||
| print(f"MEDIA:{full_path}") |
There was a problem hiding this comment.
PR description says “every other skill and test uses the no-space format”, but the repo includes tests/events that use a spaced form like MEDIA: ./image.png / MEDIA: https://... (e.g. src/auto-reply/reply.block-streaming.test.ts:261, src/infra/outbound/message-action-runner.test.ts:572, src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.subscribeembeddedpisession.e2e.test.ts:283). Please update the PR description to reflect that whitespace is currently tolerated in some places, even if this skill should emit the canonical no-space form.
|
This pull request has been automatically marked as stale due to inactivity. |
…ge.py (openclaw#18706) The MEDIA: output token must appear at line start with no space after the colon for OpenClaw's splitMediaFromOutput parser to extract the file path and auto-attach media on outbound chat channels (Discord, Telegram, WhatsApp, etc.). The script was printing 'MEDIA: /path' (with space), which while tolerated by the regex, does not match the canonical 'MEDIA:/path' format used by all other skills (e.g. openai-image-gen) and tested in the codebase (pi-embedded-subscribe.tools.media.test.ts, media/parse.test.ts). Also updated the comment to clarify the format constraint.
* main: Mattermost: harden interaction callback binding (openclaw#38057) WhatsApp: honor outbound mediaMaxMb (openclaw#38097) openai-image-gen: validate --background and --style options (openclaw#36762) Docs: align BlueBubbles media cap wording Telegram/Discord: honor outbound mediaMaxMb uploads (openclaw#38065) CI: run changed-scope on main pushes Skills/nano-banana-pro: clarify MEDIA token comment (openclaw#38063) nano-banana-pro: respect explicit --resolution when editing images (openclaw#36880) CI: drop unused install-smoke bootstrap fix(nano-banana-pro): remove space after MEDIA: token in generate_image.py (openclaw#18706) docs: context engine docs(config): list the context engine plugin slot docs(plugins): add context-engine manifest kind example docs(plugins): document context engine slots and registration docs(protocol): document slash-delimited schema lookup plugin ids docs(tools): document slash-delimited config schema lookup paths fix(session): tighten direct-session webchat routing matching (openclaw#37867) feature(context): extend plugin system to support custom context management (openclaw#22201) Gateway: allow slash-delimited schema lookup paths
…ge.py (openclaw#18706) The MEDIA: output token must appear at line start with no space after the colon for OpenClaw's splitMediaFromOutput parser to extract the file path and auto-attach media on outbound chat channels (Discord, Telegram, WhatsApp, etc.). The script was printing 'MEDIA: /path' (with space), which while tolerated by the regex, does not match the canonical 'MEDIA:/path' format used by all other skills (e.g. openai-image-gen) and tested in the codebase (pi-embedded-subscribe.tools.media.test.ts, media/parse.test.ts). Also updated the comment to clarify the format constraint.
…ge.py (openclaw#18706) The MEDIA: output token must appear at line start with no space after the colon for OpenClaw's splitMediaFromOutput parser to extract the file path and auto-attach media on outbound chat channels (Discord, Telegram, WhatsApp, etc.). The script was printing 'MEDIA: /path' (with space), which while tolerated by the regex, does not match the canonical 'MEDIA:/path' format used by all other skills (e.g. openai-image-gen) and tested in the codebase (pi-embedded-subscribe.tools.media.test.ts, media/parse.test.ts). Also updated the comment to clarify the format constraint.
…ge.py (openclaw#18706) The MEDIA: output token must appear at line start with no space after the colon for OpenClaw's splitMediaFromOutput parser to extract the file path and auto-attach media on outbound chat channels (Discord, Telegram, WhatsApp, etc.). The script was printing 'MEDIA: /path' (with space), which while tolerated by the regex, does not match the canonical 'MEDIA:/path' format used by all other skills (e.g. openai-image-gen) and tested in the codebase (pi-embedded-subscribe.tools.media.test.ts, media/parse.test.ts). Also updated the comment to clarify the format constraint.
…ge.py (openclaw#18706) The MEDIA: output token must appear at line start with no space after the colon for OpenClaw's splitMediaFromOutput parser to extract the file path and auto-attach media on outbound chat channels (Discord, Telegram, WhatsApp, etc.). The script was printing 'MEDIA: /path' (with space), which while tolerated by the regex, does not match the canonical 'MEDIA:/path' format used by all other skills (e.g. openai-image-gen) and tested in the codebase (pi-embedded-subscribe.tools.media.test.ts, media/parse.test.ts). Also updated the comment to clarify the format constraint.
…ge.py (openclaw#18706) The MEDIA: output token must appear at line start with no space after the colon for OpenClaw's splitMediaFromOutput parser to extract the file path and auto-attach media on outbound chat channels (Discord, Telegram, WhatsApp, etc.). The script was printing 'MEDIA: /path' (with space), which while tolerated by the regex, does not match the canonical 'MEDIA:/path' format used by all other skills (e.g. openai-image-gen) and tested in the codebase (pi-embedded-subscribe.tools.media.test.ts, media/parse.test.ts). Also updated the comment to clarify the format constraint.
Summary
The
generate_image.pyscript in thenano-banana-proskill printsMEDIA: /path(with a space after the colon), which does not match the canonicalMEDIA:/pathformat used by all other skills and tested throughout the codebase.Problem
OpenClaw's
splitMediaFromOutputparser (insrc/media/parse.ts) andextractToolResultMediaPaths(insrc/agents/pi-embedded-subscribe.tools.ts) extract media file paths from lines starting withMEDIA:. While the regexMEDIA:\s*tolerates an optional space, every other skill and test uses the no-space format:openai-image-genoutputs paths without the spacepi-embedded-subscribe.tools.media.test.tstestsMEDIA:/tmp/screenshot.png(no space)media/parse.test.tstestsMEDIA:/Users/pete/My File.png(no space)The space caused inconsistency and could interact poorly with downstream consumers that expect the canonical format.
Changes
skills/nano-banana-pro/scripts/generate_image.py: Changedprint(f"MEDIA: {full_path}")toprint(f"MEDIA:{full_path}")Testing
SKILL.md("The script prints aMEDIA:line")Greptile Summary
Fixes the
MEDIA:token format innano-banana-pro'sgenerate_image.pyby removing the space after the colon, aligning it with the canonicalMEDIA:{path}format used by every other media token producer in the codebase (tts-tool.ts,nodes-tool.ts,common.ts) and expected by all tests.print(f"MEDIA: {full_path}")→print(f"MEDIA:{full_path}")ingenerate_image.py:174MEDIA_TOKEN_REregex insrc/media/parse.tstolerates optional whitespace via\s*, so the old format worked but was inconsistent with all other producers and testsConfidence Score: 5/5
Last reviewed commit: 80174c8
(2/5) Greptile learns from your feedback when you react with thumbs up/down!