Skip to content

fix: keep Codex sign-in links working in chats without buttons - #204900

Merged
obviyus merged 2 commits into
openclaw:mainfrom
shu-chen-dot-ca:fix-204846-question-url-text-fallback
Nov 24, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
shu-chen-dot-ca:fix-204846-question-url-text-fallback

Conversation

@shu-chen-dot-ca

@shu-chen-dot-ca shu-chen-dot-ca commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Root cause: src/agents/harness/user-input-bridge.ts:61 (and :125 for the presentation block) ran the runtime's single-line display escaper over the whole question text, which for a Codex browser step is also the only copy of the sign-in link on channels without buttons, so _ became _ (U+FF3F), each line break became ? and the link returned Invalid URL.

Fixes #204846

Thanks @DougButdorf for the precise report (exact delivered text, the question.list record and the root cause), and @shu-chen-dot-ca for the fix this PR builds on.

What Problem This Solves

When Codex asks you to finish a step in your browser (for example reconnecting a ChatGPT connector), channels that show the question as plain text received a link that no longer worked: the _ in the address was replaced by a fullwidth look-alike, and the line breaks around it arrived as ??. Opening the link returned Invalid URL, so the step could not be completed and the turn stayed blocked on the question.

What changed

The question text is now escaped line by line, so paragraphs stay paragraphs. The line that is exactly the question's own url (the line OpenClaw itself writes for a browser step) is left as it is, unless the link contains whitespace or one of < > @ ` [ ] ( ) * ~ |. Those are the characters the escaper exists to neutralize (mentions, HTML, code, markdown links and emphasis), minus _ and &, which ordinary sign-in links use. A link that contains any of them is escaped exactly as before. Every other line, including the server's message and any copy of the link inside it, is escaped exactly as before. Headers, option labels and descriptions are untouched.

Channels with buttons show the same readable question text above unchanged buttons. Copilot questions keep their line breaks instead of ?. With no formatter the text is passed through byte for byte, as before.

The issue's second point (a reply that matches no option keeps bouncing) is not changed here; it alters pending-question behavior and is a separate decision.

Maintainer follow-up on top of the contributor commit: narrowed the literal exemption from "every occurrence of the link inside any line" to "the line that is exactly the link", dropped the whitespace-preserving split that only that wider rule needed, and folded the 8 added test cases into one two-row regression through the real Codex bridge (red on the merge base).

Evidence

Built Gateway runs (proof comment): the Codex runtime runs against a stand-in app-server that raises the reporter's exact browser step, delivered to a text-only channel (qa-channel, authored fallback text) and to Telegram with inline buttons (stub Bot API). Two runs each on the merge base 6400a15695 and this head 8d86412a4e.

  • Merge base, both runs: …request.??https://chatgpt.com/apps/google-drive/connector_5f3c…??Open the link…, which is the reporter's text exactly.
  • This head, both runs: blank-line-separated paragraphs, with the link on its own line and byte-equal to the url in question.list. Codex receives accept after the answer.
  • Controls: markup in the server's message stays escaped, byte-identical to the base. A link containing @ or * stays escaped, byte-identical to the base. On Telegram, reply_markup is identical (Open link is the raw url on both); only the question text above it becomes readable, and it now links the full URL instead of a truncated …/connector.
  • extensions/codex/src/app-server/user-input-bridge.elicitation.test.ts: one two-row regression through the real Codex bridge. Both rows fail against the base bridge and pass here.
  • Checks on this head: oxfmt and oxlint; the Codex and Copilot input-bridge tests, run-attempt, attempt-active-run, question-channel-runtime.generation, agent-harness-runtime and gateway-question (7 shards passed); pnpm check:changed.

Line deltas against the merge base: production +22/−2 in one file, tests +30 in one file. Against the contributor's head: production −11 lines, tests −48 lines (8 cases folded into 2 rows; the harness-level case is removed because the Codex-bridge regression covers the same behavior end to end).

Merge danger

Two-way door: display-only change in one function; no stored state, config or protocol. A revert fully restores the old text. Blast radius: question prompts from agent harnesses that pass a display formatter (Codex, Copilot), on text-only and button channels.

@clawsweeper

clawsweeper Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 24, 2026
@clawsweeper

clawsweeper Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserve paragraph breaks and the question’s own browser URL in harness question text while retaining escaping elsewhere.

Example: Codex sends a text-only browser step containing https://chatgpt.com/apps/google-drive/connector_5f3c8c41.

  • Before: The delivered address contains connector_5f3c8c41 and paragraph breaks become ??, breaking the link.
  • After: The address retains connector_5f3c8c41 on its own line with readable paragraph breaks.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused repair with meaningful regressions and built-Gateway before/after evidence using controlled external endpoints.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The exact-head proof comment exercises the changed formatter through a built Gateway using controlled Codex input and channel endpoints, records intact fallback URL bytes and preserved escaping controls, and confirms accept reaches Codex; it resolves the prior review’s delivery gap without claiming live connector authentication.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users receiving Codex browser steps as plain text cannot open the corrupted connector link and complete the pending step.
Reason: Restores the existing literal-destination contract without changing confirmation semantics; the report’s separate reply-fallthrough suggestion is explicitly deferred.

Merge readiness

✅ Ready for maintainer review

This PR repairs a current browser-step formatting bug with a focused shared-owner fix; no actionable defects were found, and exact-head CI remains pending.

Priority: P0
Reviewed head: 8d86412a4eff72ab1ba689c594ebe0e137388709

Before merge

None.

Findings

None.

Agent review details

How this fits together

The shared harness formatter converts Codex and Copilot questions into authored fallback text and portable presentation blocks for Gateway channel delivery.

flowchart TD
  A[Codex elicitation] --> B[Structured input compiler]
  B --> C[Shared question formatter]
  D[Copilot question] --> C
  C --> E[Authored fallback text]
  C --> F[Portable presentation]
  E --> G[Gateway channel delivery]
  F --> G
Loading

Technical review

Best possible solution:

Land the focused shared-formatter repair once required checks pass, restoring an intact inline browser link and readable completion instructions.

Do we have a high-confidence way to reproduce the issue?

Current-main source deterministically corrupts underscores and newlines on this path, and supplied built-Gateway base/head traces demonstrate the reported failure and repair.

Is this the best way to solve the issue?

This is a small, complete repair of the formatting invariant in its existing shared owner, with one reused helper and two distinct regression cases.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e04d625a4825.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 21d67b1 adds src/agents/harness/user-input-bridge.ts:38 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 21d67b168a8b; files: src/agents/harness/user-input-bridge.ts)

PR surface

Source +20, Tests +30. Total +50 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 22 2 +20
Tests 1 30 0 +30
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 52 2 +50

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: same_root_cause
Canonical: #204846
Summary: This PR addresses the canonical report’s URL and newline corruption; the earlier alternative PR is closed unmerged.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove proof: 📸 screenshot: Current real behavior proof evidence kind is logs.

Label justifications:

  • P0: The supplied UX override applies: the reported connector reauthentication flow delivers an unusable link and leaves the user blocked without an effective in-product recovery path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-24T21:35:27.772Z sha febd63e :: needs real behavior proof before merge. :: none

Reviewed November 24, 2026, 5:45 PM ET / 22:45 UTC (Revision 2).

Escape question text per line; leave the line that is exactly the question's own url literal unless it carries markup or mention characters. Fold the tests into one regression through the Codex bridge.
@shu-chen-dot-ca

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Runtime proof on the built Gateway (pnpm build in a secretless node:24.22.1 container, dist/index.js started through QA Lab). The Codex runtime is pointed at a stand-in app-server that raises the reporter's URL-mode "Browser step" elicitation (same message and connector URL as #204846). The text-only channel is qa-channel, which has no presentation renderer, so the authored fallback text is what ships, as on buzz with inline buttons off. The button channel is Telegram against a stub Bot API with inline buttons on. Each run answers through question.resolve, and Codex receives accept.

Reporter case, text-only channel, merge base 6400a15695 (same on both runs):

Codex needs confirmation:

Browser step
Reconnect Google Drive on ChatGPT to restore access for this request.??https://chatgpt.com/apps/google-drive/connector_5f3c8c41a1e54ad7a76272c89e2554fa??Open the link and complete the step in your browser. Then select "I've completed this step".
1. I've completed this step
2. Decline

Reply with the number or option text.

Same case, this head 8d86412a4e (same on both runs). The URL line is byte-equal to the url in question.list:

Codex needs confirmation:

Browser step
Reconnect Google Drive on ChatGPT to restore access for this request.

https://chatgpt.com/apps/google-drive/connector_5f3c8c41a1e54ad7a76272c89e2554fa

Open the link and complete the step in your browser. Then select "I've completed this step".
1. I've completed this step
2. Decline

Reply with the number or option text.

Per run (summarize.mjs): own-line-exact URL / URL line equals question.url / contains _ / contains ?? / Telegram buttons:

base-1 | 6400a15695 | control-buttons-telegram | ownLineExact=false | urlLine==question.url=false | has_=true | has??=true | tgAnchorExact=false | [Open link->url==question.url] [I've completed this step] [Decline] | P204900_DONE action=accept
base-1 | 6400a15695 | control-markup-in-text | ownLineExact=false | urlLine==question.url=false | has_=true | has??=true | tgAnchorExact=false |  | P204900_DONE action=accept
base-1 | 6400a15695 | control-url-with-at-star | ownLineExact=false | urlLine==question.url=false | has_=true | has??=true | tgAnchorExact=false |  | P204900_DONE action=accept
base-1 | 6400a15695 | reporter-text-only | ownLineExact=false | urlLine==question.url=false | has_=true | has??=true | tgAnchorExact=false |  | P204900_DONE action=accept
base-2 | 6400a15695 | control-buttons-telegram | ownLineExact=false | urlLine==question.url=false | has_=true | has??=true | tgAnchorExact=false | [Open link->url==question.url] [I've completed this step] [Decline] | P204900_DONE action=accept
base-2 | 6400a15695 | control-markup-in-text | ownLineExact=false | urlLine==question.url=false | has_=true | has??=true | tgAnchorExact=false |  | P204900_DONE action=accept
base-2 | 6400a15695 | control-url-with-at-star | ownLineExact=false | urlLine==question.url=false | has_=true | has??=true | tgAnchorExact=false |  | P204900_DONE action=accept
base-2 | 6400a15695 | reporter-text-only | ownLineExact=false | urlLine==question.url=false | has_=true | has??=true | tgAnchorExact=false |  | P204900_DONE action=accept
cand-1 | 8d86412a4e | control-buttons-telegram | ownLineExact=false | urlLine==question.url=false | has_=false | has??=false | tgAnchorExact=true | [Open link->url==question.url] [I've completed this step] [Decline] | P204900_DONE action=accept
cand-1 | 8d86412a4e | control-markup-in-text | ownLineExact=true | urlLine==question.url=true | has_=true | has??=false | tgAnchorExact=false |  | P204900_DONE action=accept
cand-1 | 8d86412a4e | control-url-with-at-star | ownLineExact=false | urlLine==question.url=false | has_=true | has??=false | tgAnchorExact=false |  | P204900_DONE action=accept
cand-1 | 8d86412a4e | reporter-text-only | ownLineExact=true | urlLine==question.url=true | has_=false | has??=false | tgAnchorExact=false |  | P204900_DONE action=accept
cand-2 | 8d86412a4e | control-buttons-telegram | ownLineExact=false | urlLine==question.url=false | has_=false | has??=false | tgAnchorExact=true | [Open link->url==question.url] [I've completed this step] [Decline] | P204900_DONE action=accept
cand-2 | 8d86412a4e | control-markup-in-text | ownLineExact=true | urlLine==question.url=true | has_=true | has??=false | tgAnchorExact=false |  | P204900_DONE action=accept
cand-2 | 8d86412a4e | control-url-with-at-star | ownLineExact=false | urlLine==question.url=false | has_=true | has??=false | tgAnchorExact=false |  | P204900_DONE action=accept
cand-2 | 8d86412a4e | reporter-text-only | ownLineExact=true | urlLine==question.url=true | has_=false | has??=false | tgAnchorExact=false |  | P204900_DONE action=accept

Controls, byte-compared with the merge base:

  • Markup in the server's message (<@&123456> **Drive** [here](https://evil.example/x) for agent_pip): that line is byte-identical to the base (&lt;@&amp;123456&gt; ∗∗Drive∗∗ [here](https://evil.example/x) for agent_pip.). Only the line breaks and the URL's own line changed.
  • A URL containing @ and *: the URL line is byte-identical to the base's escaped form (https://chatgpt.com/apps/@google-drive/connector_∗5f3c8c41∗).
  • Telegram with buttons: reply_markup is identical (Open link url == question.url on both), and parse_mode is HTML on both. Before, the text linked a truncated …/connector and showed _5f3c…??. Now it shows the full link in its own paragraph.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Nov 24, 2026
@obviyus
obviyus merged commit 25efa33 into openclaw:main Nov 24, 2026
149 of 152 checks passed
@obviyus

obviyus commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Merged in 25efa33. Thanks @shu-chen-dot-ca for the fix and @DougButdorf for the clear report in #204846. When Codex asks you to finish a step in your browser, channels without buttons now receive the exact link on its own line, with the instructions as separate paragraphs, so the link opens instead of returning "Invalid URL". Other question text is escaped as before, and channels with buttons keep the same buttons.

@shu-chen-dot-ca
shu-chen-dot-ca deleted the fix-204846-question-url-text-fallback branch November 24, 2026 23:04
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…law#204900)

Root cause: `src/agents/harness/user-input-bridge.ts:61` (and `:125` for the presentation block) ran the runtime's single-line display escaper over the whole question text, which for a Codex browser step is also the only copy of the sign-in link on channels without buttons, so `_` became `_` (U+FF3F), each line break became `?` and the link returned `Invalid URL`.

Fixes openclaw#204846

Thanks @DougButdorf for the precise report (exact delivered text, the `question.list` record and the root cause), and @shu-chen-dot-ca for the fix this PR builds on.

## What Problem This Solves

When Codex asks you to finish a step in your browser (for example reconnecting a ChatGPT connector), channels that show the question as plain text received a link that no longer worked: the `_` in the address was replaced by a fullwidth look-alike, and the line breaks around it arrived as `??`. Opening the link returned `Invalid URL`, so the step could not be completed and the turn stayed blocked on the question.

## What changed

The question text is now escaped line by line, so paragraphs stay paragraphs. The line that is exactly the question's own `url` (the line OpenClaw itself writes for a browser step) is left as it is, unless the link contains whitespace or one of `` < > @ ` [ ] ( ) * ~ | ``. Those are the characters the escaper exists to neutralize (mentions, HTML, code, markdown links and emphasis), minus `_` and `&`, which ordinary sign-in links use. A link that contains any of them is escaped exactly as before. Every other line, including the server's message and any copy of the link inside it, is escaped exactly as before. Headers, option labels and descriptions are untouched.

Channels with buttons show the same readable question text above unchanged buttons. Copilot questions keep their line breaks instead of `?`. With no formatter the text is passed through byte for byte, as before.

The issue's second point (a reply that matches no option keeps bouncing) is not changed here; it alters pending-question behavior and is a separate decision.

Maintainer follow-up on top of the contributor commit: narrowed the literal exemption from "every occurrence of the link inside any line" to "the line that is exactly the link", dropped the whitespace-preserving split that only that wider rule needed, and folded the 8 added test cases into one two-row regression through the real Codex bridge (red on the merge base).

## Evidence

Built Gateway runs ([proof comment](openclaw#204900 (comment))): the Codex runtime runs against a stand-in app-server that raises the reporter's exact browser step, delivered to a text-only channel (qa-channel, authored fallback text) and to Telegram with inline buttons (stub Bot API). Two runs each on the merge base `adb8e2b56f` and this head `8d86412a4e`.

- Merge base, both runs: `…request.??https://chatgpt.com/apps/google-drive/connector_5f3c…??Open the link…`, which is the reporter's text exactly.
- This head, both runs: blank-line-separated paragraphs, with the link on its own line and byte-equal to the `url` in `question.list`. Codex receives `accept` after the answer.
- Controls: markup in the server's message stays escaped, byte-identical to the base. A link containing `@` or `*` stays escaped, byte-identical to the base. On Telegram, `reply_markup` is identical (`Open link` is the raw `url` on both); only the question text above it becomes readable, and it now links the full URL instead of a truncated `…/connector`.
- `extensions/codex/src/app-server/user-input-bridge.elicitation.test.ts`: one two-row regression through the real Codex bridge. Both rows fail against the base bridge and pass here.
- Checks on this head: oxfmt and oxlint; the Codex and Copilot input-bridge tests, `run-attempt`, `attempt-active-run`, `question-channel-runtime.generation`, `agent-harness-runtime` and `gateway-question` (7 shards passed); `pnpm check:changed`.

Line deltas against the merge base: production +22/−2 in one file, tests +30 in one file. Against the contributor's head: production −11 lines, tests −48 lines (8 cases folded into 2 rows; the harness-level case is removed because the Codex-bridge regression covers the same behavior end to end).

## Merge danger

Two-way door: display-only change in one function; no stored state, config or protocol. A revert fully restores the old text. Blast radius: question prompts from agent harnesses that pass a display formatter (Codex, Copilot), on text-only and button channels.

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: codex P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codex: question prompt escaping mangles URLs on text-fallback channels (_ -> U+FF3F, \n -> ?), user can't complete Browser step

2 participants