Skip to content

fix: preserve large pasted prompts as plain text#3062

Open
chindris-mihai-alexandru wants to merge 7 commits intotailcallhq:mainfrom
chindris-mihai-alexandru:fix/avoid-path-wrap-in-large-pastes
Open

fix: preserve large pasted prompts as plain text#3062
chindris-mihai-alexandru wants to merge 7 commits intotailcallhq:mainfrom
chindris-mihai-alexandru:fix/avoid-path-wrap-in-large-pastes

Conversation

@chindris-mihai-alexandru
Copy link
Copy Markdown
Contributor

Summary

Prevent large pasted prompts and multiline pastes from being auto-converted into @[...] attachments, which avoids spurious binary-file errors when pasted text happens to contain absolute paths.

Context

Forge currently auto-wraps pasted absolute paths so drag-and-drop file references become attachments immediately. That behavior works well for short path pastes, but it also catches paths embedded inside large prompts, logs, or snippets. When those paths point to executables such as /usr/bin/env, Forge later tries to open them as attachments and surfaces Binary files are not supported / application/x-mach-binary, even though the user only pasted plain text.

I could not find an existing upstream issue or PR for this exact behavior after searching the Forge repository and broader GitHub issue search.

Changes

  • Added a guard that preserves pasted text unchanged when the paste is multiline
  • Added a guard that preserves pasted text unchanged when a single-line paste exceeds a conservative size threshold
  • Kept the existing fast path for intentional drag-and-drop style pastes where the whole paste is a single real path
  • Added regression tests for multiline prompts and large single-line prompts containing real absolute paths

Key Implementation Details

The new logic keeps whole-path detection intact, so direct file pastes like /tmp/file.txt or quoted drag-and-drop paths still become attachments. Token-by-token path wrapping now only runs for smaller single-line pastes, which are much more likely to represent intentional path references than arbitrary prompt text.

Use Cases

  • Paste a long debugging prompt that mentions /usr/bin/env without Forge turning it into an attachment
  • Paste multiline logs or stack traces containing absolute paths without triggering binary attachment errors
  • Continue dragging a single file path into the prompt and have it wrapped automatically as before

Testing

cargo test -p forge_main
cargo check
cargo clippy -p forge_main --all-targets -- -D warnings

Links

  • Branch: fix/avoid-path-wrap-in-large-pastes
  • Commit: 174266e24

chindris-mihai-alexandru and others added 6 commits April 6, 2026 21:34
Add AdaL CLI by SylphAI as a new provider option in ForgeCode. AdaL is
registered as an OpenAI-compatible provider with api.sylph.ai endpoints,
enabling ForgeCode users to access AdaL's models via API key auth.

Changes:
- Add 'adal' entry to provider.json with OpenAI response type
- Add ProviderId::ADAL constant to forge_domain
- Wire up display_name ("AdaL"), FromStr, and built_in_providers()
- Add missing FromStr arms for vertex_ai_anthropic, bedrock, opencode_zen
- Add unit tests for ADAL display name, from_str, and built_in_providers

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
Add Modal as a new provider in ForgeCode, enabling access to Z.ai's
GLM-5 745B parameter model hosted on Modal's infrastructure. Modal
offers an OpenAI-compatible API endpoint with free GLM-5 access
until April 30th, 2026.

Changes:
- Add 'modal' entry to provider.json with GLM-5-FP8 model
- Add ProviderId::MODAL constant to forge_domain
- Wire up display_name ("Modal"), FromStr, and built_in_providers()
- Add unit tests for MODAL display name, from_str, and built_in_providers

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
Combines both provider branches to enable AdaL (SylphAI) and Modal (GLM-5) support.

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
# Conflicts:
#	crates/forge_domain/src/provider.rs
#	crates/forge_repo/src/provider/provider.json
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
Copilot AI review requested due to automatic review settings April 17, 2026 22:02
@github-actions github-actions bot added the type: fix Iterations on existing features or infrastructure. label Apr 17, 2026
Copy link
Copy Markdown

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

This PR adjusts Forge’s bracketed-paste handling so large or multiline pastes remain plain text instead of having embedded absolute paths auto-wrapped into @[...] attachments, preventing confusing “binary file” attachment errors from incidental paths in prompts/logs.

Changes:

  • Skip token-by-token absolute-path wrapping when the paste is multiline or exceeds a size threshold.
  • Add regression tests covering multiline prompts and large single-line prompts that contain real absolute paths.
  • Add ACP_TRACKING.md (appears unrelated to the paste-wrapping fix described in the PR).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
crates/forge_main/src/zsh/paste.rs Adds guards to preserve large/multiline pastes as plain text and introduces regression tests.
ACP_TRACKING.md Adds an ACP integration tracking checklist (not referenced by the PR’s summary/goal).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ACP_TRACKING.md Outdated
Comment thread ACP_TRACKING.md Outdated
Comment thread crates/forge_main/src/zsh/paste.rs Outdated
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants