Validate /goal objective length in TUI#20746
Merged
Merged
Conversation
fcoury-oai
approved these changes
May 4, 2026
Contributor
fcoury-oai
left a comment
There was a problem hiding this comment.
Confirmed working as intended with a minor optional finding.
Code looks good 👍
| SlashCommandDispatchSource::Live => GoalObjectiveValidationSource::Live, | ||
| SlashCommandDispatchSource::Queued => GoalObjectiveValidationSource::Queued, | ||
| }; | ||
| if !self.goal_objective_is_allowed(objective, validation_source) { |
Contributor
There was a problem hiding this comment.
I was able to replicate a potential minor issue here. To replicate do the following:
- send a normal message that take a little while to complete (eg., "send 4 large paragraphs for testing")
- queue a
/goalwith more than 4000 characters with Tab - queue
continuewith Tab
Expected: once the first message completes, /goal is sent and the error message is displayed, then continue to the continue message.
Actual: we stop at the /goal error with the continue message still queue.
I think this is more an "unexpected behavior" than an error. So I will leave the decision to fix it or not at your discretion.
Collaborator
Author
There was a problem hiding this comment.
Yes, good catch. Fixed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Long
/goaldefinitions currently reach lower-level goal validation and can produce an opaque failure. This bug was reported by a user. Pasted instruction blocks are especially confusing because the composer can still contain a paste placeholder before expansion, which may otherwise fall into the generic prompt-size error path.There was also a related paste edge case where
/goalfollowed by a multiline block whose first pasted line was blank looked like a bare/goalcommand. That showed the goal usage/summary instead of setting the pasted objective.What Changed
This adds TUI-side preflight validation for
/goal <objective>using the sharedMAX_THREAD_GOAL_OBJECTIVE_CHARSlimit. Oversized typed, queued, and pasted goal objectives now fail locally with a goal-specific message that recommends putting longer instructions in a file and referencing that file from the goal.The TUI now also lets inline-argument slash commands consume later-line arguments before treating the first line as a bare command, so
/goalfollowed by blank lines and then objective text sets the goal instead of opening the bare/goalflow.Manual Testing
/goalfollowed by exactly 4,000 objective characters. It should continue through the normal goal-setting path./goalfollowed by 4,001 objective characters. It should not set a goal, and should showGoal objective is too long: 4,001 characters. Limit: 4,000 characters.followed by the guidance to put longer instructions in a file and reference that file from the goal./goal, paste a large block that becomes a[Pasted Content ... chars]placeholder, then submit. It should validate the expanded pasted text and show the goal-specific file guidance rather than the generic prompt-size error./goal, paste a multiline block whose first line is blank, then submit. It should set the objective from the non-blank pasted content instead of showingUsage: /goal <objective>or the bare goal summary./goalcommand. When the queue drains, it should show the same goal-specific error and should not emit a goal-setting request.