Skip to content

feat(tool_search): add deferred tool loading support for GPT-5.4+#2853

Open
amitksingh1490 wants to merge 37 commits into
mainfrom
tool-search-gpt-5.4
Open

feat(tool_search): add deferred tool loading support for GPT-5.4+#2853
amitksingh1490 wants to merge 37 commits into
mainfrom
tool-search-gpt-5.4

Conversation

@amitksingh1490
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions Bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Apr 5, 2026
Comment thread crates/forge_repo/src/provider/openai_responses/repository.rs
Comment thread crates/forge_repo/src/conversation/conversation_record.rs Outdated
Comment on lines +256 to 257
let consumed_tso_indices: std::collections::HashSet<usize> = Default::default();

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.

The consumed_tso_indices HashSet is created but never populated. This means the check at line 435 if consumed_tso_indices.contains(&idx) will always return false, and the logic to skip already-consumed ToolSearchOutput messages will never work.

This appears to be incomplete implementation - the code creates the tracking variable but never inserts any indices into it. If ToolSearchOutput entries should be consumed inline with assistant messages and skipped later, the code needs to actually track which indices were consumed.

// Either remove the unused tracking logic:
for (idx, entry) in messages.iter().enumerate() {
    match &entry.message {
        // ... handle messages without the consumed_tso_indices check
    }
}

// OR implement the actual tracking when consuming inline
Suggested change
let consumed_tso_indices: std::collections::HashSet<usize> = Default::default();
// TODO: Implement tracking of consumed ToolSearchOutput indices if needed for deduplication

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment thread crates/forge_domain/src/response_item.rs
}
ContextMessage::ToolSearchOutput(_) => {
// Tool search output is OpenAI Responses API specific - skip for Anthropic
Message { role: Role::User, content: vec![] }
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[CORRECTNESS — HIGH] ToolSearchOutput is emitted as an empty Anthropic message

The comment says this Responses-only item is skipped, but the branch still serializes it as a user message with an empty content array. If a persisted conversation containing ToolSearchOutput is later sent through Anthropic, this can produce an invalid or semantically empty user message instead of omitting the item.

Recommendation: Filter ContextMessage::ToolSearchOutput out before provider-specific message conversion, or change the conversion to return an optional message so this variant is truly omitted rather than serialized as an empty message.

Comment thread crates/forge_repo/src/provider/openai_responses/request.rs
Comment thread crates/forge_repo/src/provider/openai_responses/response.rs
Copy link
Copy Markdown
Contributor Author

@amitksingh1490 amitksingh1490 left a comment

Choose a reason for hiding this comment

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

Additional review after re-checking the replay path.

Comment thread crates/forge_repo/src/provider/openai_responses/response.rs
@amitksingh1490 amitksingh1490 changed the title feat(tool_search): add deferred tool loading support for GPT-5.4 feat(tool_search): add deferred tool loading support for GPT-5.4+ Apr 29, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

Action required: PR inactive for 5 days.
Status update or closure in 10 days.

@github-actions github-actions Bot added the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant