Skip to content

Conversation

@aibrahim-oai
Copy link
Collaborator

No description provided.

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 143 to 153
if let Ok(json) = serde_json::from_str::<serde_json::Value>(content) {
if let Some(output) = json.get("output")
&& output
.as_str()
.unwrap_or("")
.starts_with("Total output lines:")
&& output.as_str().unwrap_or("").contains("omitted")
{
error_or_panic(format!(
"FunctionCallOutput content was already truncated before ContextManager::record_items; this would cause double truncation {content}"
));
Copy link
Contributor

Choose a reason for hiding this comment

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

P1 Badge Keep substring fallback after JSON parse

When content is the serialized Vec<ContentBlock> that we build in FunctionCallOutputPayload::from(&CallToolResult), serde_json::from_str succeeds and returns a Value::Array. Because arrays (and even Value::String) do not have an output key, this new branch short-circuits and we never reach the raw content.contains("Total output lines:") check. The previous implementation caught these double-truncation cases because it examined the string regardless of shape; now the guard silently fails for exactly the shapes our shell/MCP tool outputs use, so double truncation will slip through. We should still run the raw-string fallback whenever the parsed JSON doesn’t contain an output field.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai enabled auto-merge (squash) November 15, 2025 06:37
@aibrahim-oai aibrahim-oai force-pushed the tighten_panic_double_truncation branch from a56a0f4 to e91a3b8 Compare November 15, 2025 07:11
@aibrahim-oai aibrahim-oai merged commit 3f1c4b9 into main Nov 15, 2025
25 checks passed
@aibrahim-oai aibrahim-oai deleted the tighten_panic_double_truncation branch November 15, 2025 07:29
@github-actions github-actions bot locked and limited conversation to collaborators Nov 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants