Skip to content

fix(nano-banana-pro): remove space after MEDIA: token#18706

Merged
vincentkoc merged 1 commit intoopenclaw:mainfrom
ABFS-Inc:fix/nano-banana-pro-media-token-space
Mar 6, 2026
Merged

fix(nano-banana-pro): remove space after MEDIA: token#18706
vincentkoc merged 1 commit intoopenclaw:mainfrom
ABFS-Inc:fix/nano-banana-pro-media-token-space

Conversation

@QuantDeveloperUSA
Copy link
Copy Markdown
Contributor

@QuantDeveloperUSA QuantDeveloperUSA commented Feb 17, 2026

Summary

The generate_image.py script in the nano-banana-pro skill prints MEDIA: /path (with a space after the colon), which does not match the canonical MEDIA:/path format used by all other skills and tested throughout the codebase.

Problem

OpenClaw's splitMediaFromOutput parser (in src/media/parse.ts) and extractToolResultMediaPaths (in src/agents/pi-embedded-subscribe.tools.ts) extract media file paths from lines starting with MEDIA:. While the regex MEDIA:\s* tolerates an optional space, every other skill and test uses the no-space format:

  • openai-image-gen outputs paths without the space
  • pi-embedded-subscribe.tools.media.test.ts tests MEDIA:/tmp/screenshot.png (no space)
  • media/parse.test.ts tests MEDIA:/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: Changed print(f"MEDIA: {full_path}") to print(f"MEDIA:{full_path}")
  • Updated the comment to clarify the no-space, line-start format constraint

Testing

  • Verified the change matches the format in SKILL.md ("The script prints a MEDIA: line")
  • Confirmed alignment with all existing tests in the codebase

Greptile Summary

Fixes the MEDIA: token format in nano-banana-pro's generate_image.py by removing the space after the colon, aligning it with the canonical MEDIA:{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.

  • Removed trailing space in print(f"MEDIA: {full_path}")print(f"MEDIA:{full_path}") in generate_image.py:174
  • Updated the inline comment to document the no-space, line-start format constraint
  • The MEDIA_TOKEN_RE regex in src/media/parse.ts tolerates optional whitespace via \s*, so the old format worked but was inconsistent with all other producers and tests

Confidence Score: 5/5

  • This PR is safe to merge — it's a minimal one-line format fix that aligns with all existing conventions.
  • The change is a trivial, well-motivated format fix: removing a single space in a print statement to match the canonical MEDIA token format used everywhere else. The parser already handles both formats, so there is zero risk of breakage. The comment update is accurate and helpful.
  • No files require special attention.

Last reviewed commit: 80174c8

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

…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.
Copilot AI review requested due to automatic review settings February 17, 2026 00:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +172 to +173
# OpenClaw parses MEDIA: tokens (line-start, no space after colon)
# and will attach the file on supported chat providers.
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
# 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.

Copilot uses AI. Check for mistakes.
Comment on lines +172 to +174
# OpenClaw parses MEDIA: tokens (line-start, no space after colon)
# and will attach the file on supported chat providers.
print(f"MEDIA:{full_path}")
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels Feb 22, 2026
@vincentkoc vincentkoc merged commit 86a89d9 into openclaw:main Mar 6, 2026
31 of 32 checks passed
jerrycaimin pushed a commit to jerrycaimin/openclaw that referenced this pull request Mar 6, 2026
…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.
mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 6, 2026
* 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
Saitop pushed a commit to NomiciAI/openclaw that referenced this pull request Mar 8, 2026
…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.
jenawant pushed a commit to jenawant/openclaw that referenced this pull request Mar 10, 2026
…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.
dhoman pushed a commit to dhoman/chrono-claw that referenced this pull request Mar 11, 2026
…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.
senw-developers pushed a commit to senw-developers/va-openclaw that referenced this pull request Mar 17, 2026
…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.
V-Gutierrez pushed a commit to V-Gutierrez/openclaw-vendor that referenced this pull request Mar 17, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants