Skip to content

fix: record first-output timing for tool-only Responses streams - #6259

Draft
xyjk0511 wants to merge 1 commit into
lidge-jun:devfrom
xyjk0511:fix/tool-output-first-timing
Draft

xyjk0511 wants to merge 1 commit into
lidge-jun:devfrom
xyjk0511:fix/tool-output-first-timing

Conversation

@xyjk0511

@xyjk0511 xyjk0511 commented Sep 29, 2026 •

Copy link
Copy Markdown

Summary

  • Record first-output timing for nonempty response.function_call_arguments.delta and response.custom_tool_call_input.delta events in native Responses SSE, and nonempty tool_call_delta arguments in the adapter bridge. Tool-only turns otherwise finish with output-token usage but no first-output timestamp.
  • Preserve once-only reporting and exclusions for empty deltas, tool scaffolding, lifecycle events, and steering/injection controls. No TPS arithmetic, routing, credentials, or request-body logging changes.
  • Add regressions using actual bridge streams and fragmented native SSE, including custom tools, later prose, completion, and invalid/empty input. Update the transport contracts and dashboard documentation to clarify the observation boundary.
  • This is a narrow upstream version of a locally verified fix. First-output timing remains a proxy observation; it does not measure the start of hidden reasoning or exact decoding throughput.

Verification

  • Before the production fix, the updated tool-only bridge regression and custom-tool regression failed; both native SSE tool-delta regressions also failed at the first-output assertion before later prose.
  • bun test tests/adapters/bridge.test.ts tests/server/response-log-inspection.test.ts tests/responses/sse-inspector-bounds.test.ts tests/server/management-api-logs-metrics.test.ts: 183 passed, 0 failed.
  • bun run typecheck: passed.
  • bun run privacy:scan: passed.
  • bun run structure:check: passed.
  • cd docs-site && bun install --frozen-lockfile && bun run build: passed; 545 pages built and 74,644 internal links checked.
  • git diff --check: passed.
  • bun run test:changed: started through the repository wrapper, resolved the dev comparison commit, and launched Bun's import-connected changed test lane. Stopped after several minutes without a returned lane result on this Windows machine; not counted as passing. This broader result and the full repository suite remain outstanding before review readiness.
  • The full repository suite has not been run. This PR stays draft while broader validation and repository review-readiness requirements remain outstanding. Focused coverage exercises the changed stream boundaries; it is not a full-suite claim.
  • No upstream GUI files changed, so no GUI screenshot is required.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. No auth or credential behavior changes; privacy scan passed.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • Required local validation passed; commands, results, and any full-suite exception are documented.

  • I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Constraint: Keep the existing once-only callback and empty/control-event exclusions in native and adapted Responses streams.
Rejected: Match every event ending in .delta | control and echo payloads must not start output timing.
Confidence: high
Scope-risk: narrow
Directive: First-output timing is a proxy observation, not the start of hidden reasoning or exact model decoding.
Tested: 183 focused Bun tests; TypeScript typecheck; privacy scan; structure checks; documentation build; pre-fix regressions reproduce missing timing.
Not-tested: Full repository suite; upstream live inference on this dev checkout.
@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ Required local validation passed; commands, results, and any full-suite exception are documented.
  • ⬜ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

0/4 boxes ticked.

This PR stays in draft until every box above is ticked.

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 62 / 80

이 PR은 Responses 스트림에서 “첫 출력” 시각을 찍을 때, 글자·추론만 보던 구멍을 고칩니다. 도구만 나오는 턴은 예전에 출력 토큰은 있는데 첫 출력 시각이 비었습니다. 네이티브 SSE는 비어 있지 않은 response.function_call_arguments.delta와 response.custom_tool_call_input.delta를, 어댑터 다리는 비어 있지 않은 tool_call_delta 인자를 첫 출력으로 칩니다. 빈 delta, 도구 시작 알림, steer/inject 같은 제어 프레임은 예전처럼 타이머를 안 켭니다. 한 번만 보고하는 규칙도 그대로입니다. 대시보드·transport 문서에 “프록시가 처음 본 출력”이지 숨은 추론 시작이나 정확한 디코딩 속도가 아니라고 적어 두었습니다. base는 dev입니다. 초점은 좁고, TPS·라우팅·자격 증명·요청 본문 로그는 안 건드립니다.

tests/adapters/bridge.test.ts - 빈 인자·공백 " "·"{}"를 넣어, 공백도 length>0이면 첫 출력으로 칩니다. 글자/추론과 같은 규칙이라 일관됩니다. 다만 도구 스트림이 패딩 공백만 먼저 보내면 TTFT가 아주 이르게 보일 수 있습니다.
src/server/responses/native-steering-log.ts - 스티어링 로그 쪽은 이미 *.delta 문자열이면 첫 출력으로 칩니다. 이번 수정 대상은 메인 inspector/firstOutputFromParsed와 다리입니다. 경로는 둘로 나뉘어 있어도, 도구-only 구멍은 이번으로 메워집니다.
작성자 본문 - focused 183테스트·typecheck·privacy·structure·docs 빌드는 통과했다고 적혀 있습니다. test:changed는 중간에 멈췄고, 전체 스위트는 안 돌렸습니다. review readiness 체크리스트는 아직 0/4이고 PR은 draft입니다. tip of dev와는 커밋 1개(무관한 Anthropic threshold #6207)만큼 갈라져 있습니다.

메인테이너의 판단이 필요한 지점

도구 인자의 공백 한 글자도 첫 출력으로 둘지, trim 후에만 칠지. draft·체크리스트·전체 스위트를 머지 전 필수로 둘지, 경계 테스트+호스트 CI만으로 충분한지.

너의 추천

동작 방향은 맞고, 다리·네이티브·문서가 한목소리입니다. 공백 규칙은 지금처럼 length>0으로 두고, tip of dev에 맞춘 뒤 readiness를 채운 다음 머지하세요. 미리보기 배포 이야기는 이 PR과 무관하니 건너뛰세요.

이 댓글은 grok-bot이 작성했습니다

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

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants