Skip to content

examples: handle Live replies and session finalization - #3060

Open
markstuart-oai wants to merge 10 commits into
mainfrom
markstuart/live-transcript-final-answer-20261027
Open

markstuart-oai wants to merge 10 commits into
mainfrom
markstuart/live-transcript-final-answer-20261027

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

The Live transcript example could end while the model was still speaking or before the server confirmed closure. Redirecting stdin from /dev/null also stopped capture during startup, while terminal Ctrl-C could print a successful result and exit zero.

The example now waits for the caller to finish capture and for the server to confirm session.close with session.closed reason close_requested. A terminal user presses Enter to finish; unattended runs capture for up to 45 seconds. Ctrl-C cancels capture, closes the connection and audio players, suppresses the success summary, and exits 130. Finishing before startup rejects promptly. Transport errors, other closure reasons, premature closure, and deadlines fail the operation.

The helper no longer guesses completion from transcript timing. The initial speech check only chooses when to play the second clip. The change covers the example, README, callers, and tests; SDK APIs and dependencies are unchanged.

Validation: 37 focused helper, audio-player, and CLI tests passed on Node 22. The three CLI cases also passed on Node 24, including a real Linux terminal Ctrl-C test. Strict project TypeScript, scoped formatting, and lint passed. The final assertion uses ES2020-compatible operations. The paid live test remains opt-in and uses its own 45-second observation window; it does not assert that the model has produced a complete answer.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Castiron custom code

Evaluated main: 60224b376e25912bb1143007c81d2ecdc7a7434c.

Trusted main policy: 60224b376e25912bb1143007c81d2ecdc7a7434c.

✅ No new custom-code files detected.

0 mixed files remain; 0 existing customizations changed.

Compared 60224b376e25 → 21e33204452e. Generated baselines verified.

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 40529415312 --repo openai/openai-node \
  --name castiron-custom-code-40529415312-1 --dir /tmp/castiron-custom-code-40529415312-1
git apply --stat /tmp/castiron-custom-code-40529415312-1/custom-code.patch
cat /tmp/castiron-custom-code-40529415312-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin 60224b376e25912bb1143007c81d2ecdc7a7434c 21e33204452edd48567836ceb9a3a56b1a3aea0d
python3 scripts/castiron/custom_code_report.py report \
  --base 60224b376e25912bb1143007c81d2ecdc7a7434c \
  --head 21e33204452edd48567836ceb9a3a56b1a3aea0d --target-branch main --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-21e33204452e
cat /tmp/castiron-custom-code-21e33204452e/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@markstuart-oai
markstuart-oai marked this pull request as ready for review October 27, 2026 17:52
@markstuart-oai
markstuart-oai requested a review from a team as a code owner October 27, 2026 17:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-28T06:17:41.992725Z e506abd New commits
🔒 Security Review ✅ Completed 2026-10-28T06:17:41.059267Z e506abd 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: 21e3320445

ℹ️ 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 examples/live/transcript-demo.ts Outdated
Comment thread examples/live/transcript-demo.ts Outdated
@markstuart-oai markstuart-oai changed the title fix(examples): recognize Live replies during audio upload examples: handle Live replies and session finalization Oct 28, 2026

@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: f5ed65711f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread examples/live/transcript-demo.ts Outdated

@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: 4e84426af5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread examples/live/transcript-demo.ts
Comment thread examples/live/transcript-demo.ts
@markstuart-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 12c48b8df6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 12c48b8df6

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@markstuart-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 12c48b8df6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 12c48b8df6

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread examples/live/transcript-grouper.ts Outdated
Comment thread examples/live/transcript-grouper.ts Outdated

@jbeckwith-oai jbeckwith-oai 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.

Requesting changes for the two confirmed CLI regressions already identified by Dan; referencing the existing threads to avoid duplicate inline comments:

  • Redirected stdin (for example, /dev/null) emits close and aborts capture before session startup. Please provide an explicit bounded noninteractive path: #3060 (comment)
  • Terminal Ctrl-C closes readline and triggers the same successful finish path as Enter. Please distinguish interruption, preserve cleanup, and return a nonzero exit: #3060 (comment)

The helper finalization and failure handling otherwise look sound. Please cover stdin EOF and Ctrl-C at the CLI boundary.

Static review of commit 12c48b8. Hosted checks show no failures (applicable checks passed; other jobs skipped). No local tests or candidate code were run.

@markstuart-oai
markstuart-oai force-pushed the markstuart/live-transcript-final-answer-20261027 branch from 12c48b8 to beb1b6d Compare October 28, 2026 06:08

@jbeckwith-oai jbeckwith-oai 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.

The earlier stdin EOF and Ctrl-C findings are fixed: noninteractive capture is bounded, and cancellation interrupts work, cleans up playback, and exits 130. One new compilation failure remains below. Hosted lint and breaking-change detection both fail with TS2550, not an SDK API compatibility regression. Other test jobs are still running.

Static re-review with an independent reviewer; no candidate code or local tests run.

Comment thread tests/lib/live/transcript-demo.test.ts Outdated

@jbeckwith-oai jbeckwith-oai 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.

The TypeScript issue is fixed, and all three added CLI tests passed in hosted Node 26. One PR-introduced flaky assertion remains: the playback test assumes the child cannot observe EOF before termination. Hosted Node 26 failed only this test (12,182 passed, one failed, two skipped). This is a test race, not evidence of failed playback cancellation.

Static re-review with an independent reviewer; no candidate code or local tests run.

Comment thread tests/lib/live/transcript-playback.test.ts

@jbeckwith-oai jbeckwith-oai 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.

Re-reviewed the latest fix, including an independent static second pass. Moving the EOF-marker precondition before close() removes the scheduler-dependent assertion without weakening the process-termination and repeated-close checks. The earlier redirected-input, cancellation-exit, and TypeScript compatibility findings are also addressed. No remaining actionable findings.

Hosted CI is green, including Node.js 22/24/26 and OkTest. Review was static; no candidate code or tests were run locally.

console.log('Capturing for up to 45 seconds, then closing the session.');
}
const result = await runTranscriptDemo(client, audio, {
finishSignal: input ? finish.signal : AbortSignal.timeout(45_000),

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.

[P2] Preserve automatic completion for the default terminal invocation. Running the documented command in a terminal previously captured a conversation and returned without keyboard input. It now selects an untimed finish.signal, so leaving the same command unattended never requests normal session closure and eventually fails at the helper's 120-second deadline instead of returning a transcript. The redirected-stdin fix only preserves automatic completion outside a terminal. Make Enter-only capture an explicit mode, or apply the bounded observation window in terminals too while allowing Enter to finish earlier.

This branch has not been deployed

No deployments
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.

3 participants