Skip to content

fix: resolve safe issues from automated triage - #856

Merged
1jehuang merged 12 commits into
masterfrom
agent/triage-open-issues-20260809
Aug 9, 2026
Merged

1jehuang merged 12 commits into
masterfrom
agent/triage-open-issues-20260809

Conversation

@1jehuang

@1jehuang 1jehuang commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • normalize Copilot chat-completions tool schemas so swarm is accepted
  • make missing swarm daemon errors actionable
  • keep bare model switches on the active named catalog profile
  • default unspecified custom model inputs to text-only
  • preserve Homebrew launcher arguments during formula generation

Verification

  • integrated TUI build passed with scripts/dev_cargo.sh build --profile selfdev -p jcode --bin jcode
  • Copilot runtime tests: 31 passed, including 2 new regressions
  • provider resolver suite: 117 passed
  • custom model capability tests: 8 passed
  • swarm socket tests: 3 passed
  • generated Homebrew formula line verified to retain literal $@

Fixes #855
Fixes #854
Fixes #852
Fixes #849
Fixes #847

--- — Jcode agent (automated triage), on behalf of @1jehuang

@greptile-apps

greptile-apps Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This update improves provider routing, Copilot tool-schema compatibility, daemon connection diagnostics, Homebrew launcher argument forwarding, desktop panel resizing, and terminal focus rendering.

One user-visible issue remains in OpenAI Responses streaming: after one reasoning item streams a live summary delta, a later independent reasoning item that only returns a completed summary is not shown in the transcript. The routing, socket-error mapping, desktop resizing, and Homebrew launcher paths were exercised successfully.

Confidence Score: 4/5

The release should not merge until OpenAI reasoning-summary replay is tracked per reasoning item so later summaries remain visible.

The reproduced OpenAI stream failure can cause a user to miss reasoning content from a later independent item.

Files Needing Attention: crates/jcode-provider-openai/src/stream.rs

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex produced a proof for a posted P1 finding and noted its validation in the corresponding review comment.
  • T-Rex ran the fully qualified bare-model routing tests, exercising both an absent catalog model rebinding and the active-profile retention path, and both paths passed.
  • T-Rex ran the Unix socket error mapping tests, including missing and stale paths, and observed that ENOENT and ECONNREFUSED map to the server-unavailable message while unrelated InvalidInput errors are preserved.
  • T-Rex exercised the native desktop workspace and scene tests for session counts, placement, focus transitions, rendering, and resize key bindings, and all tests passed.
  • T-Rex validated the launcher argument escaping by comparing escaped versus unescaped runs, confirming that the escaped launcher forwards runtime arguments unchanged.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P1 A live delta from one reasoning item suppresses a later item's summary

    • Bug
      • With two independent reasoning items, item r1 emits response.reasoning_summary_text.delta; item r2 has lifecycle events and a completed summary but no live delta. The parser emits OpenAIReasoning for r2 but does not emit the required ThinkingStart, ThinkingDelta("second summary"), and ThinkingEnd, losing reasoning that should be visible to the user.
    • Cause
      • parse_openai_response_event stores whether any reasoning delta has occurred in the stream-wide saw_thinking_delta flag at line 342. handle_openai_output_item checks that shared flag at line 630 when deciding whether to replay each completed item's summary, so a delta for an earlier item incorrectly applies to all later items.
    • Fix
      • Track streamed reasoning state by reasoning item ID (for example, HashSet<String> keyed by item_id), and suppress summary replay only when the completed item's own ID has a live delta. Add a regression test for a live-delta reasoning item followed by a summary-only reasoning item.

    T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
### Issue 1
crates/jcode-provider-openai/src/stream.rs:342
**Reasoning summaries are suppressed across independent items**

`saw_thinking_delta` is maintained for the entire response stream rather than for a specific reasoning item. Once item `r1` emits `response.reasoning_summary_text.delta`, a later item `r2` that has no live delta but does provide a completed summary reaches `handle_openai_output_item` with the flag already set. The parser emits `OpenAIReasoning` for `r2` but skips its `ThinkingStart`, `ThinkingDelta`, and `ThinkingEnd` events, so that item's reasoning is absent from the user-visible transcript. Track streamed-summary state by reasoning item ID and suppress completed-summary replay only for the item that already streamed it.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (3): Last reviewed commit: "chore(release): prepare v0.73.0" | Re-trigger Greptile

@1jehuang

1jehuang commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

Quality Guardrails exposed a pre-existing Clippy collapsible_if failure in connection-message rendering. I fixed it in 9dcd6114a; the exact cargo fmt --all -- --check and cargo clippy --all-targets --all-features -- -D warnings gates now pass locally.

--- — Jcode agent (automated triage), on behalf of @1jehuang

@1jehuang

1jehuang commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

The rerun passes Clippy and reaches the oversized-file ratchet, which still fails. I reproduced that ratchet on an untouched detached origin/master worktree: the same nine files already exceed the checked-in baseline there. PR #856 adds 30 lines to one listed file (provider/mod.rs) but does not cause the other eight default-branch violations. Updating the global ratchet or refactoring nine unrelated files would be outside this triage PR, so this is now the only known hosted-check blocker.

--- — Jcode agent (automated triage), on behalf of @1jehuang

OpenAI Responses streams the reasoning summary twice: live via
response.reasoning_summary_text.delta, then again inside the
reasoning item on response.output_item.done. We replayed the
item.done summary as ThinkingStart/Delta/End, so the TUI rendered
the full thinking block a second time.

Track saw_thinking_delta per stream and skip the item.done summary
replay when live deltas were already streamed. The OpenAIReasoning
event (encrypted content for history/replay) is still emitted.
}
"response.reasoning.delta" | "response.reasoning_summary_text.delta" => {
if let Some(delta) = event.delta {
*saw_thinking_delta = true;

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.

P1 Reasoning summaries are suppressed across independent items

saw_thinking_delta is maintained for the entire response stream rather than for a specific reasoning item. Once item r1 emits response.reasoning_summary_text.delta, a later item r2 that has no live delta but does provide a completed summary reaches handle_openai_output_item with the flag already set. The parser emits OpenAIReasoning for r2 but skips its ThinkingStart, ThinkingDelta, and ThinkingEnd events, so that item's reasoning is absent from the user-visible transcript. Track streamed-summary state by reasoning item ID and suppress completed-summary replay only for the item that already streamed it.

Artifacts

Reproducible Rust parser test for independent reasoning items

  • This standalone Rust program invokes the exported OpenAI Responses parser with the baseline and two-item lifecycle sequences, ending with an exact StreamEvent assertion.

Single-item reasoning baseline passed

  • The executed baseline command parses one live-delta reasoning item and shows actual StreamEvents equal expected StreamEvents with exit code 0, establishing the control behavior.

Multi-item reasoning summary suppression failure

  • The executed multi-item command shows the second item's expected ThinkingStart, ThinkingDelta, and ThinkingEnd are absent and panics with exit code 101, confirming the defect.

Narrow existing OpenAI stream test attempt blocked by Cargo locks

  • The attempted narrow package test command records that concurrent builds held Cargo's package and build locks before it was stopped; the independent reproduction supplied the executed parser coverage.

View artifacts

T-Rex Ran code and verified through T-Rex

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-provider-openai/src/stream.rs
Line: 342

Comment:
**Reasoning summaries are suppressed across independent items**

`saw_thinking_delta` is maintained for the entire response stream rather than for a specific reasoning item. Once item `r1` emits `response.reasoning_summary_text.delta`, a later item `r2` that has no live delta but does provide a completed summary reaches `handle_openai_output_item` with the flag already set. The parser emits `OpenAIReasoning` for `r2` but skips its `ThinkingStart`, `ThinkingDelta`, and `ThinkingEnd` events, so that item's reasoning is absent from the user-visible transcript. Track streamed-summary state by reasoning item ID and suppress completed-summary replay only for the item that already streamed it.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@1jehuang
1jehuang merged commit d3d70f6 into master Aug 9, 2026
19 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment