Skip to content

fix(agent): keep native citation tokens out of chat replies - #1994

Merged
onmax merged 13 commits into
mainfrom
fix/agent-channel-citations
Oct 8, 2026
Merged

onmax merged 13 commits into
mainfrom
fix/agent-channel-citations

Conversation

@onmax

@onmax onmax commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Teams receives Codex native citation markers such as citeturn228505view0turn395856view0 as plain text. Updating the T3 provider runtime alone cannot turn those opaque IDs into links. The documented app-server protocol provides assistant text and web-search actions without a citation-ID-to-URL map.

Request verified Markdown source links in the Teams Channel instructions. At Chat SDK delivery, replace unresolved native citations with [source link unavailable] while preserving explicit links and attachments. Cover split or truncated stream markers, final and finish-hook replies, loading placeholders, error/restart notices, and visible AST/card text. Preserve card URLs, action payloads, and caller-owned objects. Compare formatted text when suppressing duplicate replies and record the delivered text in delivery observations. Stream cancellation completes without waiting for a stalled source read and requests source cleanup.

For example, Answer. citeturn0view0 See [the PR](https://github.com/acme/portal/pull/1188). becomes Answer. [source link unavailable] See [the PR](https://github.com/acme/portal/pull/1188). This prevents unreadable output; it does not invent or recover citation URLs.

Local baseline verification reproduced the raw screenshot markers on main in both static and streaming delivery. Final revision validation passed in CI. All verification jobs passed: all three Agent shards, every other package shard, repository lint/types, TypeScript doctor, contracts/examples, and docs checks. The Agent shards passed 7,442 tests with one skipped across 222 files. These include all 541 webhook tests, 307 provider tests, and the citation, Channel delivery, and Channel instruction suites. Nine loading-placeholder cases cover supported native/manual delivery and static/array/resolver options. Restart notices use the supported HOST_RESTARTED fallback resolver. Cancellation regressions include both a custom stalled iterator and a real async generator. The latest review found no new issues and independently passed 22 loading/restart cases.

An earlier local full-suite run was stopped after source changes and does not validate the final code. The duplicate focused local job was cancelled while queued after CI completed its checks. No live Teams deployment was performed. The complete final CI run and latest review are green.

The T3 fork resync is now on main at ee5848bfdff74af1d14ad9464403d275e47f8822, pushed directly as requested by the maintainer. GitHub automatically marked the earlier resync PR as merged. This PR already pins the same published preview, so no dependency change or repeat validation is needed. Its runtime build, typecheck, and 125 focused provider tests pass, and its preview packages passed publint. Inherited upstream CI remains queued on its configured runners. Upstream main is already included in the fork.

Model: GPT-6.1-Sol. Harness: Codex through T3 Code.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T12:54:40.439971Z b5f3871 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown

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.

Reviewed commit: 19a8327c69

ℹ️ 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".

@pullfrog pullfrog Bot left a comment

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.

Important

The citation fallback works on the webhook paths, but the PR adds failing owner-package tests and leaves supported structured chat messages unsanitized.

Reviewed changes in 19a8327c6, covering the citation formatter, Teams instructions, every changed Chat SDK delivery boundary, documentation, and regression tests.

  • Citation formatting: Replaces complete and truncated Codex native citation markers with [source link unavailable] while preserving ordinary Markdown links.
  • Delivery integration: Applies formatting to primary streams, collected final replies, finish-hook messages, manual placeholder edits, and message-channel reply effects.
  • Teams guidance: Requests descriptive Markdown links to verified URLs and prohibits native citation IDs.
  • Regression coverage: Adds formatter split tests and webhook final, loading, manual, and streaming cases.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

@pullfrog pullfrog Bot left a comment

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.

Important

The new commits address both earlier behavior findings, but the added AST regression still fails and leaves the owner-package checks red.

Reviewed changes since the prior pullfrog review at 19a8327c6, covering commits e938ceaca..a5c89a9ec.

  • Structured messages: Recursively formats mdast text and visible card fields while preserving URLs and action values.
  • Truncated markers: Replaces every incomplete native marker prefix at finalization instead of leaking private-use characters.
  • Direct Channel test: Returns the finish-hook reply effect so static and streaming manual delivery cases execute.
  • Provider runtime: Updates the embedded T3 provider-runtime preview and its lockfile graph.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

@pkg-pr-new

pkg-pr-new Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vite-hub/agent

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/agent@1994

@vite-hub/auth

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/auth@1994

@vite-hub/blob

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/blob@1994

@vite-hub/box

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/box@1994

@vite-hub/browser

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/browser@1994

@vite-hub/channels

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/channels@1994

@vite-hub/cli

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/cli@1994

@vite-hub/connections

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/connections@1994

@vite-hub/content

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/content@1994

@vite-hub/database

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/database@1994

@vite-hub/email

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/email@1994

@vite-hub/env

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/env@1994

@vite-hub/kv

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/kv@1994

@vite-hub/markdown-template

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/markdown-template@1994

@vite-hub/queue

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/queue@1994

@vite-hub/rate-limit

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/rate-limit@1994

@vite-hub/realtime

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/realtime@1994

@vite-hub/runtime

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/runtime@1994

@vite-hub/sandbox

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/sandbox@1994

@vite-hub/schedule

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/schedule@1994

@vite-hub/shell

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/shell@1994

@vite-hub/source

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/source@1994

@vite-hub/ui

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/ui@1994

vite-hub

pnpm add https://pkg.pr.new/vite-hub/vitehub/vite-hub@1994

@vite-hub/workflow

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/workflow@1994

@vite-hub/workspace

pnpm add https://pkg.pr.new/vite-hub/vitehub/@vite-hub/workspace@1994

commit: b5f3871

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes since the prior Pullfrog review at a5c89a9ec, covering the corrected structured-message regression and refreshed dependency snapshots.

  • Corrected AST and card assertions: Compared semantic structured-message content without requiring incompatible mdast source positions or exact object equality.
  • Stabilized dependency snapshots: Preserved peer-dependent lockfile variants and added integrity metadata for the refreshed T3 runtime tarballs.

Pullfrog  | View workflow run | Using gpt-5.6-sol | 𝕏

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

Copy link
Copy Markdown

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.

Reviewed commit: 4f8be6ef66

ℹ️ 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 thread packages/agent/src/server/routes.ts Resolved

@pullfrog pullfrog Bot left a comment

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.

Important

The new commits add two regressions that must be addressed before merge: one new owner-package scenario is red, and the cancellation change does not work for the async-generator streams used by the runtime.

Reviewed changes since the prior Pullfrog review at 4f8be6ef6, covering commits 528402007 and 97ac8a7be.

  • Formatted error fallbacks: Applied citation cleanup to resolved error fallback text and added webhook coverage for automatic and manual delivery.
  • Extended restart coverage: Added a host-restart scenario intended to verify citation cleanup in a custom restart notice.
  • Changed stream cancellation: Replaced the async-generator formatter wrapper with a custom iterator that forwards return() and throw() to its source.
  • Added cancellation regression coverage: Exercised cancellation while a custom source iterator has a pending next() call.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/agent/test/providers.test.ts Resolved

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

Copy link
Copy Markdown

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.

Reviewed commit: 4f01831561

ℹ️ 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 thread packages/agent/src/server/routes.ts Resolved

@pullfrog pullfrog Bot left a comment

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.

Important

The cancellation fix is complete, but the revised restart regression still leaves the Agent package checks red because the fixture constructs an invalid Agent definition.

Reviewed changes since the prior Pullfrog review at 97ac8a7be, covering commit 4f0183156.

  • Unblocked stream cancellation: Raced pending source reads against wrapper cancellation, requested queued async-generator cleanup without blocking delivery shutdown, and added a real async-generator regression.
  • Moved restart fallback configuration: Placed the citation-bearing fallback on the Channel options consumed by interrupted webhook recovery, but retained the incompatible chat capability in the same fixture.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/agent/test/providers.test.ts Resolved

@pullfrog pullfrog Bot left a comment

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.

Important

The new loading-placeholder and restart regressions still leave focused Agent checks red.

Reviewed changes since the prior Pullfrog review at 4f0183156, covering commits 10759bb64 and ff0f51ba0.

  • Formatted resolved loading placeholders: Applied citation cleanup to static, array-selected, and resolver-produced loading text across native and manual delivery setup.
  • Expanded loading regression coverage: Added a matrix for both loading option names, three configuration forms, and native or manual delivery.
  • Corrected restart fixture shape: Removed the incompatible chat capability from the Channel-based citation notice scenario.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/agent/test/providers.test.ts Resolved
Comment thread packages/agent/test/providers.test.ts Resolved

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes since the prior Pullfrog review at ff0f51ba0, covering the two test corrections that close the remaining findings.

  • Selected restart fallback by error code: Used the supported errorFallbackText resolver contract so HOST_RESTARTED delivers and formats the citation-bearing notice.
  • Limited loading coverage to valid delivery modes: Kept native streaming on fallbackStreamingPlaceholderText and exercised messages.loading through manual non-streaming delivery across static, array, and resolver forms.
  • Verified focused regressions: Passed all 22 selected loading-placeholder and host-restart cases in providers.test.ts.

Pullfrog  | View workflow run | Using gpt-5.6-sol | 𝕏

@onmax
onmax merged commit 0e65d92 into main Oct 8, 2026
22 checks passed
@onmax
onmax deleted the fix/agent-channel-citations branch November 1, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant