Fix ChatGPT Web tool calls and web permission approvals#59
Open
sandro-salles wants to merge 3 commits into
Open
Fix ChatGPT Web tool calls and web permission approvals#59sandro-salles wants to merge 3 commits into
sandro-salles wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses failures when using the ChatGPT Web Codex/Responses endpoint (by forcing non-persistent requests and removing stale item_references), and fixes the web permissions UX/API integration so approvals and filesystem scopes can be managed and applied live.
Changes:
- Force ChatGPT Web requests to be non-persistent (
store=false) and stripitem_referenceentries before calling the Codex Responses endpoint; add unit coverage for the sanitizer. - Update the chat permission prompt UI to use the backend’s expected approval actions (
yes/always/no) and render prompt text. - Expose and edit filesystem scopes in the Permissions page, and wire the web Permissions API to the live
PermissionManagerinstance.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/pages/Permissions.tsx | Adds a Filesystem Scopes editor and updates capability parsing to ignore non-boolean entries. |
| ui/src/pages/Chat.tsx | Fixes permission prompt actions, renders prompt text, and adds basic resolve/expiry feedback. |
| ui/src/components/chat/PermissionPrompt.tsx | Updates actions/status text for permission prompts (component appears unused). |
| src/web/server.ts | Re-exports setPermissionManager so the web layer can be wired to the live permission manager. |
| src/web/api/system.ts | Uses an injected PermissionManager for /api/permissions so changes take effect immediately. |
| src/providers/chatgpt-web.ts | Sanitizes outgoing requests: forces store=false, stream=true, and removes item_reference inputs. |
| src/providers/chatgpt-web.test.ts | Adds a Vitest unit test validating sanitization behavior. |
| src/index.ts | Wires the live PermissionManager from capabilities into the web server. |
| src/core/agent.ts | Passes provider options to force inline tool-call continuations for ChatGPT Web (openai.store=false). |
Comments suppressed due to low confidence (1)
ui/src/components/chat/PermissionPrompt.tsx:76
- This
PermissionPromptcomponent appears to be unused (no imports/usages found inui/src), whileui/src/pages/Chat.tsxdefines its ownPermissionPrompt. Consider deleting this component or refactoring to a single shared implementation to avoid divergence over time.
<div className="flex flex-wrap items-center gap-2">
<Button size="sm" onClick={() => handleAction("yes")}>
Allow Once
</Button>
<Button
size="sm"
variant="outline"
onClick={() => handleAction("always")}
>
Always
</Button>
<Button
size="sm"
variant="ghost"
onClick={() => handleAction("no")}
>
Deny
</Button>
</div>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const [originalCapabilities, setOriginalCapabilities] = useState<Capabilities>({}); | ||
| const [loading, setLoading] = useState(true); | ||
| const [saving, setSaving] = useState(false); | ||
| const [newScopePath, setNewScopePath] = useState("/home/operacional/workspace"); |
Comment on lines
+153
to
+160
| {resolved ? ( | ||
| <p className="mt-3 text-xs text-muted-foreground"> | ||
| {resolved === "always" | ||
| ? "Always allowed and saved." | ||
| : resolved === "yes" | ||
| ? "Allowed for this request." | ||
| : "Denied."} | ||
| </p> |
Comment on lines
49
to
56
| {resolved ? ( | ||
| <p className="text-xs text-muted-foreground"> | ||
| {resolved === "allow" ? "Allowed" : "Denied"} | ||
| {resolved === "always" | ||
| ? "Always allowed and saved" | ||
| : resolved === "yes" | ||
| ? "Allowed for this request" | ||
| : "Denied"} | ||
| </p> |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Verification
Context
The ChatGPT Web Codex endpoint rejects persisted responses with store=true, but tool-call continuations could still include item_reference rows. That produced failures like: Item with id 'rs_*' not found. The web permissions UI also emitted allow/deny actions while the backend waited for yes/always/no, so approval prompts could not be resolved from the dashboard.