Skip to content

Honor explicit image actions from the first step and separate captions - #221

Merged
iamwavecut merged 3 commits into
mainfrom
fix/image-request-tool-and-caption
Oct 10, 2026
Merged

iamwavecut merged 3 commits into
mainfrom
fix/image-request-tool-and-caption

Conversation

@iamwavecut

@iamwavecut iamwavecut commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Explicit image commands could receive prose instead of a tool call, and generated-image captions exposed the optimized technical prompt.

The message router now records explicit image intent before inference and places it at the beginning of the first dynamic user packet. The pending action selects the native image function from the first step. A text-only response is rejected and repaired; exhausted repairs never publish a false promise. Actual failed tool attempts remain reportable, and newer messages from the initiator replace or cancel the pending action. Earlier calls cannot fulfill a newer request, and canonical-history deduplication preserves the inbox intent. Other participants cannot replace the initiator's action.

draw_image and draw_api now accept a separate optional readable caption. Without one, the runtime uses the original source request. Scheduled generation preserves the technical prompt and visible caption in their existing separate fields; the direct API path uses the same bounded HTML caption builder. Old serialized tool calls and checkpoints remain readable.

Validation: cargo fmt --all; git diff --check; cargo test --workspace --all-targets (2462 passed, 10 ignored); cargo clippy --workspace --all-targets -- -D warnings. Regression coverage checks first-packet intent and stable system prefix, native tool choice, rejected prose and exhausted repairs, actual tool failure, scheduling caption separation, direct API photo captions, and positive/negative command recognition. No schema migration.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Warnings
⚠️ Prompt files are cache-sensitive contracts; confirm prompt shape and role markers were preserved intentionally.
Messages
📖 Danger checked 15 changed file(s).

Generated by 🚫 dangerJS against 586ddd9

@iamwavecut

Copy link
Copy Markdown
Owner Author

Prompt changes are intentional. The system/user role markers and the cached-prefix/dynamic-first-packet layout are preserved. Explicit action intent now appears at the start of the first dynamic packet, before history. The new regression checks that this dynamic intent does not change the rendered system prefix. Tool contracts now distinguish generation instructions from readable captions; old serialized calls and checkpoints default the optional fields. All workspace tests, fmt, and Clippy passed at the current head.

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🔒 No security concerns identified
⚡ Recommended focus areas for review

Pending intent dropped for newer explicit command

When an injected message from the same user arrives, requested_tool is unconditionally cleared instead of being replaced with the newer message's own requested_tool. A user who sends a follow-up explicit command (e.g. "!draw cat") while a draw session is already pending will have the new intent silently discarded, so the forced required_tool never applies for that request. Consider copying meta.requested_tool from the newer message rather than clearing.

if params.user_id == active_params.user_id {
    tool_context.message_meta.requested_tool.clear();
}

@iamwavecut

Copy link
Copy Markdown
Owner Author

Fixed the newer-command finding. The initiator's newer intent now replaces the prior intent; a plain follow-up clears it. Calls before that message no longer fulfill the new request. The inbox metadata is also applied when canonical history already observed the same message, so the deduplication boundary cannot discard the explicit intent. Other participants cannot replace the initiator's intent. The persisted call offset defaults to zero for older checkpoints. Regression coverage exercises all three sender/intent cases through both inbox-only and history-before-inbox paths. All workspace tests, fmt, and Clippy passed.

@iamwavecut
iamwavecut merged commit 0f050bc into main Oct 10, 2026
12 checks passed
@iamwavecut
iamwavecut deleted the fix/image-request-tool-and-caption branch October 10, 2026 11:37
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.

1 participant