fix: strip message wrapper in CLI session title generation#7996
fix: strip message wrapper in CLI session title generation#7996DOsinga merged 4 commits intoblock:mainfrom
Conversation
generate_simple_session_description() was taking the first 4 words from the raw user message, which includes the ---BEGIN USER MESSAGES--- wrapper added by generate_session_name(). This caused all CLI provider sessions to be titled "---BEGIN USER MESSAGES---" instead of something meaningful. Strip the wrapper markers before extracting words so the title reflects actual user content. Closes block#7990 Signed-off-by: Extra Small <[email protected]>
Signed-off-by: Extra Small <[email protected]>
84b8ff6 to
c863087
Compare
| // Strip the wrapper added by generate_session_name so we get | ||
| // the actual user content instead of "---BEGIN USER MESSAGES---". | ||
| let stripped = text | ||
| .strip_prefix("---BEGIN USER MESSAGES---") |
There was a problem hiding this comment.
this seems rather brittle - if we change the marker on the other side of this, it will break. at a minimum use constants, but it would be even better if there was just a flag on providers that tells them whether to use this stripped down algorithm or to do the full call and check that at the callers side.
There was a problem hiding this comment.
yeah good point, the string matching is fragile. let me refactor — I'll extract the markers into constants at minimum, and also look into whether we can avoid the wrapping altogether by the time it hits generate_simple_session_description.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65a5c3ffe1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| let desc: String = stripped | ||
| .split_whitespace() | ||
| .take(4) | ||
| .collect::<Vec<_>>() | ||
| .join(" ") | ||
| .join(" "); |
There was a problem hiding this comment.
Truncate stripped CLI session titles to the same 100-char limit
When the opening user prompt starts with a long unbroken token (JWT, pasted key, minified JSON, etc.), this now returns that token verbatim as the session title. Unlike the normal Provider::generate_session_name path in crates/goose/src/providers/base.rs:682-687, the CLI shortcut never runs safe_truncate(..., 100), so Session.name can grow arbitrarily large before it is persisted in sessions.name (crates/goose/src/session/session_manager.rs:562-565). Please cap or post-process the simple title here the same way as the main path.
Useful? React with 👍 / 👎.
Signed-off-by: Extra Small <[email protected]>
65a5c3f to
6b22628
Compare
|
refactored — markers are now constants (SESSION_NAME_PREFIX / SESSION_NAME_SUFFIX). also looked into skipping the wrap entirely but that touches the provider trait boundary so keeping it scoped for now. lmk if this looks better |
match the truncation limit from the full provider path so titles stay bounded even with long single-token inputs. Signed-off-by: Extra Small <[email protected]>
* main: (337 commits) fix: replace panics with user-friendly errors in CLI session builder (#7901) fix: read GOOSE_CONTEXT_LIMIT from config.yaml, not just env vars (#7900) fix: deliver truncation notice as separate content block (#7899) fix: use platform-appropriate commands in developer extension instructions (#7898) fix: replace any with proper SVG types in icon components (#7873) chore: remove debug console.log statements, stale comments, and dead code (#8142) feat: Gemini OAuth provider (#8129) chore(deps): bump picomatch from 2.3.1 to 2.3.2 in /documentation (#8123) feat: show installed skills in UI (#7910) fix(deps): gate keyring platform features behind target-specific deps (#8039) chore(deps): bump yaml from 2.8.2 to 2.8.3 in /evals/open-model-gym/suite (#8124) fix: strip message wrapper in CLI session title generation (#7996) fix(providers): fall back to configured models when models endpoint fetch fails (#7530) chore(deps): bump brace-expansion from 5.0.3 to 5.0.5 in /evals/open-model-gym/suite (#8139) fix: prevent Ollama provider from hanging on tool-calling requests (#7723) fix: VMware Tanzu Platform provider - bug fixes, streaming, UI improvements (#8126) feat: allow GOOSE_CLI_SHOW_THINKING to be set in config.yaml (#8097) fix: GitHub Copilot auth fails to open browser in Desktop app (#6957) (#8019) fix(ci): produce .tar.gz archives for Zed ACP registry compatibility (#8054) feat: add GOOSE_SHOW_FULL_OUTPUT config to disable tool output truncation (#7919) ... # Conflicts: # crates/goose/src/providers/formats/openai.rs
Signed-off-by: Extra Small <[email protected]> Signed-off-by: Cameron Yick <[email protected]>
* main: (337 commits) fix: replace panics with user-friendly errors in CLI session builder (#7901) fix: read GOOSE_CONTEXT_LIMIT from config.yaml, not just env vars (#7900) fix: deliver truncation notice as separate content block (#7899) fix: use platform-appropriate commands in developer extension instructions (#7898) fix: replace any with proper SVG types in icon components (#7873) chore: remove debug console.log statements, stale comments, and dead code (#8142) feat: Gemini OAuth provider (#8129) chore(deps): bump picomatch from 2.3.1 to 2.3.2 in /documentation (#8123) feat: show installed skills in UI (#7910) fix(deps): gate keyring platform features behind target-specific deps (#8039) chore(deps): bump yaml from 2.8.2 to 2.8.3 in /evals/open-model-gym/suite (#8124) fix: strip message wrapper in CLI session title generation (#7996) fix(providers): fall back to configured models when models endpoint fetch fails (#7530) chore(deps): bump brace-expansion from 5.0.3 to 5.0.5 in /evals/open-model-gym/suite (#8139) fix: prevent Ollama provider from hanging on tool-calling requests (#7723) fix: VMware Tanzu Platform provider - bug fixes, streaming, UI improvements (#8126) feat: allow GOOSE_CLI_SHOW_THINKING to be set in config.yaml (#8097) fix: GitHub Copilot auth fails to open browser in Desktop app (#6957) (#8019) fix(ci): produce .tar.gz archives for Zed ACP registry compatibility (#8054) feat: add GOOSE_SHOW_FULL_OUTPUT config to disable tool output truncation (#7919) ... # Conflicts: # crates/goose/src/providers/formats/openai.rs
CLI providers (gemini-cli, claude_code, codex, cursor_agent) all generate session titles like
---BEGIN USER MESSAGES---becausegenerate_simple_session_description()grabs the first 4 words from the raw message — which includes the wrapper thatgenerate_session_name()adds around the actual user content.This strips the
---BEGIN USER MESSAGES---/---END USER MESSAGES---markers before extracting words, so titles actually reflect what the user said.Single-file change, pretty straightforward.
Closes #7990