Repository navigation
Feature/chatgpt app selection - #53
rosterbrink-awp wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
🤖 AI Code Review — ✅ Approved
Confidence: high · Findings: 3
AI judgment: APPROVE · Evidence: COMPLETE · Authority: advisory
Evidence complete · 15/15 changed files accounted for
Other findings (3)
- [medium] Unconditional markdown unescape in canonicalize_user_text regresses matching for non-app prompts with backslash-punctuation
⚠️ unverified - [medium] The unescape is lossy even in the app-composed path: literal user-typed backslashes cannot be distinguished from serializer escapes
⚠️ unverified - [medium] No test coverage for plain (non-app) prompts containing backslash-escaped punctuation through the new canonicalization path
⚠️ unverified
🔮 Devil's Advocate (2 turns): 2 missed risks found · 1 upheld
GitWire AI Review Gate (bundle-driven v2) · Structured schema · Scope-validated · Devil's Advocate · AI recommendation — maintainers and repository policy retain authority
Finding details (not annotatable inline)
-
[MEDIUM] Unconditional markdown unescape in canonicalize_user_text regresses matching for non-app prompts with backslash-punctuation (
src/chatgpt_web2api/turn_anchor.py:242)canonicalize_user_text() unconditionally strips leading app:// links and decodes one layer of backslash-escaped ASCII punctuation. It is now applied to EVERY backend user turn (user_text_matches_sent, turn_anchor.py) and to every send-POST hash (identity_listener.py:352), while the sent side is hashed/matched with normalize_text only (no decoding). For prompts sent WITHOUT apps, ChatGPT stores/POSTs the text unescaped (escaping is tied to app-link composition, as this PR's own tests show), so any logical prompt containing a literal backslash before ASCII punctuation — e.g. '*', '.', '(' from regex/LaTeX/pasted markdown source, or UNC paths like '\\server' — now breaks both correlation paths: (1) hash_sent_text(canonicalize_user_text(body)) != hash_sent_text(normalize_text(text)) leaves the capture scope unresolved (UUID capture silently lost), and (2) user_text_matches_sent decodes the parent text but not the sent text, so previously-matching identical texts no longer match, ending in TurnReconciliationError for requests that previously succeeded. A user-typed literal '$x' prefix is also wrongly stripped. Suggested fix: only strip app links / unescape when at least one leading 'app://' prompt link was actually removed (i.e., the text shows the app-composed serialization), and keep the legacy normalize_text behavior for plain turns.
-
[MEDIUM] The unescape is lossy even in the app-composed path: literal user-typed backslashes cannot be distinguished from serializer escapes
The review frames the problem as non-app prompts, but even when an app:// link IS present and legitimately stripped, decoding one layer of backslash-punctuation corrupts any prompt where the user typed a literal backslash before punctuation (e.g. a regex example or LaTeX sent while using an app). The transformation is not invertible, so the 'correct' app path also rewrites user content and can corrupt stored/matched text. The suggested fix (gate unescaping on app-link presence) does not fully resolve this; the review should have flagged the fundamental ambiguity.
-
[MEDIUM] No test coverage for plain (non-app) prompts containing backslash-escaped punctuation through the new canonicalization path
The PR's tests only exercise app-composed serialization (which is exactly why the reviewer had to infer that escaping is app-tied). A round-trip test asserting that a plain prompt like 'use . in regex' hashes and matches identically before and after the PR would have caught the reported regression. The review identified the bug but did not call out the missing negative-case tests, which is the actionable guardrail against reintroducing it.
Die Erweiterung für die Auswahl von ChatGPT-Apps ist umgesetzt und live validiert.
Umsetzung
apps-Feld für:/v1/chat/completionschat_completionappsbleibt das bestehende Verhalten unverändert.Input.insertTextden Mention-Mechanismus in bestehenden Conversations nicht zuverlässig auslöst.app://-Links und Markdown-Escaping angepasst.innerText.Live validiert
Folgende Pfade wurden gegen das reale ChatGPT Web erfolgreich getestet:
stream=true, Fresh Chatchat_completion, Fresh Chatstream=true, Follow-up in bestehender ConversationDer gemeinsame E2E-Test lieferte über GitHub und den lokalen MCP:
Damit ist der POC für die programmatische Nutzung von ChatGPT Web inklusive mehrerer ausgewählter Apps abgeschlossen.
Die automatisierten App-, Regression- und Gesamttests sind grün; Ruff und
git diff --checksind ebenfalls sauber.