Skip to content

fix(acp): state input limits in their error messages - #1917

Merged
lizhengfeng101 merged 1 commit into
alibaba:mainfrom
sisantaChhatoi:fix/acp-limit-messages
Nov 16, 2026
Merged

lizhengfeng101 merged 1 commit into
alibaba:mainfrom
sisantaChhatoi:fix/acp-limit-messages

Conversation

@sisantaChhatoi

Copy link
Copy Markdown
Contributor

Description

When ocr-acp rejects a resource link whose URI is longer than 8192 bytes, the error only says resource URI is too long. That text goes straight back to the ACP client (shown in the editor's chat panel, or read by an automated client), and 8192 bytes is OCR's own limit rather than a standard one, so the caller has no way to know how much to shorten it. The other input limits in the same function already state their values (maximum 128 blocks, 64 KiB).

  • The URI error now reads resource URI is too long (maximum 8192 bytes).
  • The three limits in promptContent and the version-probe output limit in orchestrator/resolve.go become named constants used by both the check and its message, so the stated limit cannot drift from the enforced one. The other messages read exactly as before.
  • The tests check that each message names its limit. The version-probe test now uses the exact boundary (limit + 1) instead of twice the limit.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally
  • Manual testing (describe below)

make -C acp check and make -C acp test pass, and make -C acp coverage reports 91.7%. Each new message assertion fails if its limit is removed from the message.

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA
  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

AI disclosure: prepared with Claude Code (Claude Opus 5.5). I reviewed every line and can explain each change.

Related Issues

None.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s).

@Walternater

Copy link
Copy Markdown
Contributor

Independent verification — this one looks ready.

Checked on head c16969f:

  • The three limits are now single-sourced: maxPromptBlocks/maxPromptBytes/maxResourceURIBytes in acp/internal/adapter/resources.go:16-20 and maxVersionOutputBytes in acp/internal/orchestrator/resolve.go:22. A grep for the old literals (128, 8192, 64*1024, 1024) across acp/internal finds no remaining duplicates; the only other 64 << 10 is the unrelated defaultStderrLine.
  • Boundary behaviour is unchanged, only the messages differ:
    • exactly 128 prompt blocks accepted; 129 rejected with too many prompt blocks (maximum 128);
    • exactly 64 KiB prompt accepted; 64 KiB + 1 rejected with prompt exceeds 64 KiB (the maxPromptBytes>>10 arithmetic prints 64, not 65536);
    • a resource URI beyond 8192 bytes rejected with resource URI is too long (maximum 8192 bytes);
    • the existing exact-1024 version test still pins the accepted edge.
      I ran these as temporary tests (not committed) to make sure the new assertions in resources_test.go really pin the boundaries rather than just the strings.
  • go test ./internal/adapter ./internal/orchestrator in the acp module is green (3.8s / 25.5s).
  • CI is fully green on this head (test, windows, all cross-compiles, CodeQL/CodeQL languages) and license/cla has passed; mergeStateStatus is only waiting on human review.

One optional nit, not blocking: the KiB message derives from maxPromptBytes>>10, so it stays correct only while the constant is a whole number of KiB — fine today, and a comment already implies the unit. No behavioural concerns found.

Verification was AI-assisted (DeepSeek Harness, deepseek-v4.1-flash); the boundary tests were executed locally.

@chaojixinren chaojixinren left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@lizhengfeng101
lizhengfeng101 merged commit 59e55d5 into alibaba:main Nov 16, 2026
14 checks passed
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.

4 participants