Skip to content

fix: close opencode upstream intake#155

Merged
Astro-Han merged 3 commits into
devfrom
codex/fix-i92-closeout
Apr 23, 2026
Merged

fix: close opencode upstream intake#155
Astro-Han merged 3 commits into
devfrom
codex/fix-i92-closeout

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Apr 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add content-based attachment MIME sniffing so read promotes disguised image/PDF files while keeping SVG/text paths readable.
  • Sync the remaining upstream runtime/plugin tail: GitHub Copilot Anthropic tool streaming opt-out, workspace adaptor env propagation, and skill discovery abort handling.
  • Port the small UI primitive fixes for assistant parent lookup, review diff renderability, and tool accordion sticky offsets.

Why

This is the final scoped #92 closeout after the session runtime lane in #140 landed. Desktop hardening remains tracked separately in #141/#152 and is not blocking this upstream intake closeout.

Related Issue

Closes #92

How To Verify

cd packages/opencode
bun test test/tool/read.test.ts test/session/message-v2.test.ts test/plugin/github-copilot-models.test.ts test/plugin/workspace-adaptor.test.ts
cd ../ui
bun test src/components/message-part-stale.test.ts src/components/session-turn-parent.test.ts src/components/session-review-diff-render.test.ts
cd ../..
bun turbo typecheck
bun turbo test:ci
git diff --check

Screenshots or Recordings

Not applicable. The UI changes are narrow primitive guards and sticky offset constants covered by focused source tests plus the app build in test:ci.

Checklist

  • I linked the related issue, or stated why there is no issue
  • This PR has type, scope, and priority labels, or I requested maintainer labeling
  • I listed the relevant verification steps, including tests when behavior changed
  • I manually checked visible UI or copy changes when needed, with screenshots or recordings
  • I considered macOS and Windows impact for desktop, packaging, updater, signing, paths, shell, or permissions changes
  • I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, or generated/local file changes when relevant
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English

Summary by CodeRabbit

  • Bug Fixes

    • Copilot behavior: correct handling for Anthropic-backed models and headers
    • Sticky accordion offset alignment in UI components
    • Session review diff visibility and per-file interaction states
    • Assistant threading now includes relevant follow-up assistant messages
  • Improvements

    • Improved media/attachment detection via file-signature sniffing and stricter binary checks
    • Safer PDF/image handling with size caps and proper data-URL responses
    • Workspace creation now propagates runtime environment (auth, workspace id, OTEL) to spawned processes
    • File discovery respects cancellation for faster aborts
  • Tests

    • New tests for Copilot model behavior, media sniffing, workspace env propagation, and session/message handling

@Astro-Han Astro-Han added enhancement New feature or request P2 Medium priority upstream Tracked upstream or vendor behavior labels Apr 22, 2026
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9c2d965f-e796-449b-9756-87aeff7c86e3

📥 Commits

Reviewing files that changed from the base of the PR and between 0fa3753 and 3443d08.

📒 Files selected for processing (13)
  • packages/opencode/src/control-plane/types.ts
  • packages/opencode/src/control-plane/workspace.ts
  • packages/opencode/src/plugin/github-copilot/copilot.ts
  • packages/opencode/src/tool/skill.ts
  • packages/opencode/test/plugin/github-copilot-models.test.ts
  • packages/opencode/test/plugin/workspace-adaptor.test.ts
  • packages/plugin/src/index.ts
  • packages/ui/src/components/message-part-stale.test.ts
  • packages/ui/src/components/message-part.tsx
  • packages/ui/src/components/session-review-diff-render.test.ts
  • packages/ui/src/components/session-review.tsx
  • packages/ui/src/components/session-turn-parent.test.ts
  • packages/ui/src/components/session-turn.tsx

📝 Walkthrough

Walkthrough

Adaptor create gains an optional env parameter; Workspace now builds/passes an env map (auth blob, workspace id, feature flag, OTEL entries); a new media utility with MIME sniffing is added and used by read/webfetch/message modules; Copilot Anthropic handling and several UI behavior/tests updated.

Changes

Cohort / File(s) Summary
Adaptor Environment Integration
packages/opencode/src/control-plane/types.ts, packages/opencode/src/control-plane/workspace.ts, packages/plugin/src/index.ts, packages/opencode/test/plugin/workspace-adaptor.test.ts
Added optional env?: Record<string,string> to adaptor create signature; Workspace.create constructs and passes an env map (includes OPENCODE_AUTH_CONTENT, OPENCODE_WORKSPACE_ID, OPENCODE_EXPERIMENTAL_WORKSPACES, selective OTEL_* entries). Tests updated to assert env propagation.
MIME Detection Utility & Consumers
packages/opencode/src/util/media.ts, packages/opencode/src/session/message-v2.ts, packages/opencode/src/tool/read.ts, packages/opencode/src/tool/webfetch.ts, packages/opencode/test/session/message-v2.test.ts, packages/opencode/test/tool/read.test.ts
Added media.ts with isImageAttachment/isPdfAttachment/isMedia and sniffAttachmentMime (PNG, JPEG, GIF, BMP, TIFF, PDF, WEBP, AVIF/HEIC). Replaced local MIME checks with shared helpers; read tool samples bytes for sniffing, applies binary heuristics and attachment size caps; tests extended.
Copilot Anthropic Support
packages/opencode/src/plugin/github-copilot/copilot.ts, packages/opencode/test/plugin/github-copilot-models.test.ts
Introduced COPILOT_ANTHROPIC_NPM constant and isCopilotAnthropic gating; when Copilot+Anthropic detected, sets output.options.toolStreaming = false and toggles anthropic-beta header. Tests added for positive/negative cases.
Tool Cancellation & Skill Discovery
packages/opencode/src/tool/skill.ts
Wires ctx.abort into rg.files(...) as signal to allow cancellation of ripgrep-based file streaming.
Message V2 Media Export
packages/opencode/src/session/message-v2.ts
Replaced local isMedia with import/re-export from @/util/media; ensures PDF tool attachments are emitted as media results.
Webfetch Image Handling
packages/opencode/src/tool/webfetch.ts
Delegates image detection to isImageAttachment helper; behavior unchanged aside from centralized MIME logic.
UI Session/Diff/Accordion Changes
packages/ui/src/components/session-turn.tsx, packages/ui/src/components/session-turn-parent.test.ts, packages/ui/src/components/session-review.tsx, packages/ui/src/components/session-review-diff-render.test.ts, packages/ui/src/components/message-part.tsx, packages/ui/src/components/message-part-stale.test.ts
Session-turn now selects assistant messages by parentID without early-stop at next user; session-review gates file rendering via diffCanRender() and limits bulk expand/collapse to renderable files; accordion offset changed to calc(32px + var(--tool-content-gap)). Tests added/updated.
Tests: Copilot, Read, MessageV2
packages/opencode/test/plugin/github-copilot-models.test.ts, packages/opencode/test/tool/read.test.ts, packages/opencode/test/session/message-v2.test.ts
New/updated unit tests covering Copilot Anthropic behavior, read tool MIME sniffing and truncation, and MessageV2 PDF/media emission.

Sequence Diagram(s)

sequenceDiagram
  participant Workspace
  participant AuthService as Auth.Service
  participant AppRuntime
  participant Adaptor

  Workspace->>AuthService: request auth context (Auth.Service.use(...auth.all()))
  AuthService-->>AppRuntime: auth payload (async)
  AppRuntime-->>Workspace: resolved OPENCODE_AUTH_CONTENT
  Workspace->>Adaptor: create(config, env{OPENCODE_AUTH_CONTENT, OPENCODE_WORKSPACE_ID, OPENCODE_EXPERIMENTAL_WORKSPACES, OTEL_*}, from?)
  Adaptor-->>Workspace: Promise<void>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐇 I nibble bytes and set the env,

Keys tucked softly in a tiny den.
Copilot listens when Anthropic's near,
Accordions shift and tests cheer clear.
A hopping rabbit signs off with a grin.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title succinctly captures the main objective (closing the upstream intake), but lacks descriptive specificity about the actual changes included. Consider a more descriptive title like 'fix: sync OpenCode upstream intake with MIME sniffing, env propagation, and UI primitives' to better convey the scope of changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description is comprehensive and follows the template structure, providing clear context, verification steps, and checklist completion.
Linked Issues check ✅ Passed The code changes comprehensively address the Phase 1 Runtime Resource lane objectives from #92: MIME sniffing for attachments, workspace adaptor env propagation, skill abort handling, and UI primitives.
Out of Scope Changes check ✅ Passed All changes remain within scope: attachment MIME sniffing, workspace env propagation, copilot tool streaming, skill cancellation, session turn parent logic, session review renderability, and UI sticky offset calculations are all part of the stated Phase 1/2 objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-i92-closeout

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

@Astro-Han Astro-Han marked this pull request as ready for review April 22, 2026 18:33
@Astro-Han Astro-Han force-pushed the codex/fix-i92-closeout branch from 83cdf40 to 8a9d380 Compare April 22, 2026 18:39

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicky review of the upstream-intake closeout. Findings labeled P0–P3; nothing looks blocking for the stated scope, but a few of the P1/P2 items (auth env fanout, null! on Accordion.Item, and the unbounded turn scan) feel worth a second look before merge.

  • P1: 3
  • P2: 4
  • P3: 3

Comment thread packages/opencode/src/control-plane/workspace.ts Outdated
Comment thread packages/opencode/src/control-plane/workspace.ts Outdated
Comment thread packages/plugin/src/index.ts Outdated
Comment thread packages/ui/src/components/session-review.tsx Outdated
Comment thread packages/ui/src/components/session-review.tsx Outdated
Comment thread packages/opencode/src/tool/read.ts
Comment thread packages/opencode/src/plugin/github-copilot/copilot.ts
Comment thread packages/opencode/src/util/media.ts
Comment thread packages/opencode/test/plugin/workspace-adaptor.test.ts Outdated
Comment thread packages/ui/src/components/session-turn-parent.test.ts
@Astro-Han Astro-Han force-pushed the codex/fix-i92-closeout branch from 8a9d380 to ff1efc2 Compare April 22, 2026 19:02
@Astro-Han

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/ui/src/components/session-review.tsx (1)

496-507: ⚠️ Potential issue | 🟠 Major

Include media files in the renderability gate.

Line 496 currently treats all 0/0 diffs as non-renderable, which also disables media diffs (often additions=0, deletions=0) even though they can still be previewed. This makes those rows non-interactive (trigger/view-button/chevron all gated off).

💡 Suggested fix
-                    const diffCanRender = () => diff.additions !== 0 || diff.deletions !== 0
+                    const diffCanRender = () => !!mediaKind() || diff.additions !== 0 || diff.deletions !== 0

Downstream impact: update packages/ui/src/components/session-review-diff-render.test.ts expectation that currently hardcodes the old diffCanRender expression.

Also applies to: 516-516, 557-561

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/components/session-review.tsx` around lines 496 - 507, The
renderability gate currently implemented in diffCanRender (used in the
Accordion.Trigger and related UI) treats diffs with additions===0 &&
deletions===0 as non-renderable and therefore disables media diffs; change
diffCanRender to also return true for media files by adding a media check (e.g.,
check the file variable or a diff.isBinary/diff.isImage flag or a small helper
isMediaFile(file) that matches common media extensions) so the expression
becomes: additions !== 0 || deletions !== 0 || isMediaFile(file) (or
diff.isMedia). Update the related occurrences (diffCanRender usage around
Accordion.Trigger and the other two spots called out) and adjust the test
expectation in packages/ui/src/components/session-review-diff-render.test.ts to
match the new logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/opencode/src/util/media.ts`:
- Around line 32-35: The current ftyp detection in
packages/opencode/src/util/media.ts only checks the major brand at offset 8 and
misses compatible brands; update the ftyp handling (where startsWithAt and ascii
are used against bytes) to read the ftyp box size (uint32BE at offset 0) and
iterate 4-byte brand entries starting at offset 8 up to the box size, checking
each brand for any of the known variants (e.g.,
"avif","avis","heic","hevc","heix","hevx","mif1","msf1") and returning the
correct MIME ("image/avif" or "image/heic") when a match is found; add a
regression test covering files whose compatible-brand list (not major brand)
contains these variants.

---

Outside diff comments:
In `@packages/ui/src/components/session-review.tsx`:
- Around line 496-507: The renderability gate currently implemented in
diffCanRender (used in the Accordion.Trigger and related UI) treats diffs with
additions===0 && deletions===0 as non-renderable and therefore disables media
diffs; change diffCanRender to also return true for media files by adding a
media check (e.g., check the file variable or a diff.isBinary/diff.isImage flag
or a small helper isMediaFile(file) that matches common media extensions) so the
expression becomes: additions !== 0 || deletions !== 0 || isMediaFile(file) (or
diff.isMedia). Update the related occurrences (diffCanRender usage around
Accordion.Trigger and the other two spots called out) and adjust the test
expectation in packages/ui/src/components/session-review-diff-render.test.ts to
match the new logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 53c671dc-878d-4374-be8b-fb3ed96a1ae0

📥 Commits

Reviewing files that changed from the base of the PR and between 52e46ad and ff1efc2.

📒 Files selected for processing (19)
  • packages/opencode/src/control-plane/types.ts
  • packages/opencode/src/control-plane/workspace.ts
  • packages/opencode/src/plugin/github-copilot/copilot.ts
  • packages/opencode/src/session/message-v2.ts
  • packages/opencode/src/tool/read.ts
  • packages/opencode/src/tool/skill.ts
  • packages/opencode/src/tool/webfetch.ts
  • packages/opencode/src/util/media.ts
  • packages/opencode/test/plugin/github-copilot-models.test.ts
  • packages/opencode/test/plugin/workspace-adaptor.test.ts
  • packages/opencode/test/session/message-v2.test.ts
  • packages/opencode/test/tool/read.test.ts
  • packages/plugin/src/index.ts
  • packages/ui/src/components/message-part-stale.test.ts
  • packages/ui/src/components/message-part.tsx
  • packages/ui/src/components/session-review-diff-render.test.ts
  • packages/ui/src/components/session-review.tsx
  • packages/ui/src/components/session-turn-parent.test.ts
  • packages/ui/src/components/session-turn.tsx

Comment thread packages/opencode/src/util/media.ts
@Astro-Han Astro-Han force-pushed the codex/fix-i92-closeout branch from ff1efc2 to 0d27acb Compare April 22, 2026 21:07
Comment thread packages/opencode/src/util/media.ts Outdated
Comment thread packages/opencode/src/control-plane/types.ts
Comment thread packages/opencode/src/control-plane/workspace.ts
Comment thread packages/opencode/src/util/media.ts Outdated
Comment thread packages/opencode/src/util/media.ts Outdated
Comment thread packages/opencode/src/plugin/github-copilot/copilot.ts Outdated
Comment thread packages/opencode/test/plugin/github-copilot-models.test.ts
Comment thread packages/opencode/test/tool/read.test.ts Outdated
Comment thread packages/opencode/test/plugin/workspace-adaptor.test.ts
Comment thread packages/opencode/src/tool/read.ts
Comment thread packages/opencode/src/tool/read.ts
Comment thread packages/opencode/src/tool/read.ts
@Astro-Han Astro-Han force-pushed the codex/fix-i92-closeout branch from 0d27acb to c36e423 Compare April 22, 2026 21:56

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/ui/src/components/session-review.tsx (1)

496-507: ⚠️ Potential issue | 🟠 Major

Gate expansion/rendering, not only trigger affordances.

Line 507 disables the trigger, but non-renderable rows can still be opened through controlled state (open prop / “expand all”), which makes expanded() true and still mounts diff content. That violates the “non-renderable” contract for metadata-only rows.

Suggested fix
@@
-                    const expanded = createMemo(() => open().includes(file))
+                    const diffCanRender = () => diff.additions !== 0 || diff.deletions !== 0
+                    const expanded = createMemo(() => diffCanRender() && open().includes(file))
@@
-                    const diffCanRender = () => diff.additions !== 0 || diff.deletions !== 0
+                    // moved above so render/mount logic can use it too

Also update expand-all to only include renderable files:

const renderableFiles = createMemo(() =>
  items()
    .filter((d) => d.additions !== 0 || d.deletions !== 0)
    .map((d) => d.file),
)

const handleExpandOrCollapseAll = () => {
  const next = open().length > 0 ? [] : renderableFiles()
  handleChange(next)
}

Also applies to: 557-561

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/components/session-review.tsx` around lines 496 - 507, The
Accordion currently only disables the trigger via Accordion.Trigger when
diffCanRender() is false, but expanded state (controlled via open/expanded) can
still mount diff content for non-renderable rows; update the gating so the diff
content is not rendered when diffCanRender() is false by using diffCanRender()
(or its memoized equivalent) to prevent expansion and to exclude non-renderable
files from expand-all logic: add a memo like renderableFiles based on
items().filter(d => d.additions !== 0 || d.deletions !== 0).map(d => d.file),
use that in handleExpandOrCollapseAll to only expand renderable files (call
handleChange with renderableFiles() or []), and ensure Accordion item expansion
checks diffCanRender() before rendering content (e.g., block expanded/open for
that file in the expanded() or open prop handling) so non-renderable rows never
mount their diff content.
♻️ Duplicate comments (1)
packages/opencode/src/control-plane/workspace.ts (1)

207-217: ⚠️ Potential issue | 🟠 Major

OPENCODE_AUTH_CONTENT is still over-broadly exposed to adaptor code.

Workspace.create forwards serialized auth for all providers into plugin adaptor env by default. That keeps credential exposure wider than necessary for third-party adaptors.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/opencode/src/control-plane/workspace.ts` around lines 207 - 217, The
code currently injects OPENCODE_AUTH_CONTENT with full serialized auth into
every adaptor via Workspace.create -> adaptor.create; change this so the full
auth blob is NOT forwarded by default: obtain the complete auth via
AppRuntime.runPromise(Auth.Service.use(...)) but filter it down to only the
providers the target adaptor actually needs (e.g., consult adaptor manifest or a
new adaptor.requiresAuthProviders list on the config) and only set
OPENCODE_AUTH_CONTENT when the filteredAuth is non-empty; implement this by
replacing the current Object.entries(...) block with a step that computes
filteredAuth = pick(fullAuth, requiredProviders) and only
JSON.stringify(filteredAuth) into env when present, otherwise omit
OPENCODE_AUTH_CONTENT before calling adaptor.create(config, env).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/opencode/test/plugin/workspace-adaptor.test.ts`:
- Around line 154-156: The test currently assumes OTEL env vars are unset which
makes it flaky; before constructing or inspecting created.env in
workspace-adaptor.test (the test that sets/inspects the variable named created),
explicitly remove any CI/dev OTEL variables by deleting
process.env.OTEL_EXPORTER_OTLP_HEADERS, process.env.OTEL_EXPORTER_OTLP_ENDPOINT
and process.env.OTEL_RESOURCE_ATTRIBUTES (or set them to undefined) at the start
of the test, or alternatively stub/memoize process.env and restore afterwards,
so expect(created.env).not.toHaveProperty(...) assertions are deterministic
across environments.

---

Outside diff comments:
In `@packages/ui/src/components/session-review.tsx`:
- Around line 496-507: The Accordion currently only disables the trigger via
Accordion.Trigger when diffCanRender() is false, but expanded state (controlled
via open/expanded) can still mount diff content for non-renderable rows; update
the gating so the diff content is not rendered when diffCanRender() is false by
using diffCanRender() (or its memoized equivalent) to prevent expansion and to
exclude non-renderable files from expand-all logic: add a memo like
renderableFiles based on items().filter(d => d.additions !== 0 || d.deletions
!== 0).map(d => d.file), use that in handleExpandOrCollapseAll to only expand
renderable files (call handleChange with renderableFiles() or []), and ensure
Accordion item expansion checks diffCanRender() before rendering content (e.g.,
block expanded/open for that file in the expanded() or open prop handling) so
non-renderable rows never mount their diff content.

---

Duplicate comments:
In `@packages/opencode/src/control-plane/workspace.ts`:
- Around line 207-217: The code currently injects OPENCODE_AUTH_CONTENT with
full serialized auth into every adaptor via Workspace.create -> adaptor.create;
change this so the full auth blob is NOT forwarded by default: obtain the
complete auth via AppRuntime.runPromise(Auth.Service.use(...)) but filter it
down to only the providers the target adaptor actually needs (e.g., consult
adaptor manifest or a new adaptor.requiresAuthProviders list on the config) and
only set OPENCODE_AUTH_CONTENT when the filteredAuth is non-empty; implement
this by replacing the current Object.entries(...) block with a step that
computes filteredAuth = pick(fullAuth, requiredProviders) and only
JSON.stringify(filteredAuth) into env when present, otherwise omit
OPENCODE_AUTH_CONTENT before calling adaptor.create(config, env).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ea3d73d4-c917-4f9f-baad-a8cb93b81192

📥 Commits

Reviewing files that changed from the base of the PR and between ff1efc2 and c36e423.

📒 Files selected for processing (19)
  • packages/opencode/src/control-plane/types.ts
  • packages/opencode/src/control-plane/workspace.ts
  • packages/opencode/src/plugin/github-copilot/copilot.ts
  • packages/opencode/src/session/message-v2.ts
  • packages/opencode/src/tool/read.ts
  • packages/opencode/src/tool/skill.ts
  • packages/opencode/src/tool/webfetch.ts
  • packages/opencode/src/util/media.ts
  • packages/opencode/test/plugin/github-copilot-models.test.ts
  • packages/opencode/test/plugin/workspace-adaptor.test.ts
  • packages/opencode/test/session/message-v2.test.ts
  • packages/opencode/test/tool/read.test.ts
  • packages/plugin/src/index.ts
  • packages/ui/src/components/message-part-stale.test.ts
  • packages/ui/src/components/message-part.tsx
  • packages/ui/src/components/session-review-diff-render.test.ts
  • packages/ui/src/components/session-review.tsx
  • packages/ui/src/components/session-turn-parent.test.ts
  • packages/ui/src/components/session-turn.tsx

Comment thread packages/opencode/test/plugin/workspace-adaptor.test.ts Outdated
@Astro-Han Astro-Han force-pushed the codex/fix-i92-closeout branch from c36e423 to 0fa3753 Compare April 23, 2026 01:02
@Astro-Han

Copy link
Copy Markdown
Owner Author

Handled the CodeRabbit outside-diff review body items from the latest review:

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/opencode/src/control-plane/workspace.ts`:
- Around line 209-211: The OPENCODE_WORKSPACE_ID env var is being set from
mutable runtime config.id but should come from the persisted workspace record
(info.id) so adaptors that mutate id in configure don't cause drift; update the
env construction that sets OPENCODE_WORKSPACE_ID to use the persisted workspace
identity (info.id / id from the loaded workspace record) instead of config.id
and ensure the code references the variable that holds the stored workspace info
(e.g., info) when building the env object in the same scope as where
AppRuntime.runPromise(...) is used.

In `@packages/opencode/test/plugin/github-copilot-models.test.ts`:
- Around line 165-232: Add a focused regression test that mirrors the existing
"chat.params" tests but calls hooks["chat.headers"] instead: instantiate
CopilotAuthPlugin, call hooks["chat.headers"] with a github-copilot model whose
api.npm is "@ai-sdk/anthropic" and assert the headers/options include the
Copilot-specific change (e.g., toolStreaming disabled), then call
hooks["chat.headers"] with a github-copilot OpenAI model and a non-copilot
anthropic model and assert their headers/options are unchanged (no
toolStreaming); reference CopilotAuthPlugin and hooks["chat.headers"] to locate
where to hook the new test.

In `@packages/ui/src/components/session-review.tsx`:
- Around line 266-274: The bulk-toggle logic in handleExpandOrCollapseAll
currently bases its decision on open().length which can include non-renderable
items; update handleExpandOrCollapseAll to use the same renderable-open
predicate used for the header (hasOpenRenderableFiles()) so the toggle computes
next as either [] when there are open renderable files or renderableFiles() when
none are open, and then call handleChange(next); this ensures the label and
action match the actual renderable diff rows (refer to renderableFiles(),
handleExpandOrCollapseAll, open(), handleChange, and hasOpenRenderableFiles()).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 865d7880-fa7a-4d77-8364-2116f38567a3

📥 Commits

Reviewing files that changed from the base of the PR and between c36e423 and 0fa3753.

📒 Files selected for processing (13)
  • packages/opencode/src/control-plane/types.ts
  • packages/opencode/src/control-plane/workspace.ts
  • packages/opencode/src/plugin/github-copilot/copilot.ts
  • packages/opencode/src/tool/skill.ts
  • packages/opencode/test/plugin/github-copilot-models.test.ts
  • packages/opencode/test/plugin/workspace-adaptor.test.ts
  • packages/plugin/src/index.ts
  • packages/ui/src/components/message-part-stale.test.ts
  • packages/ui/src/components/message-part.tsx
  • packages/ui/src/components/session-review-diff-render.test.ts
  • packages/ui/src/components/session-review.tsx
  • packages/ui/src/components/session-turn-parent.test.ts
  • packages/ui/src/components/session-turn.tsx

Comment thread packages/opencode/src/control-plane/workspace.ts
Comment thread packages/opencode/test/plugin/github-copilot-models.test.ts
Comment thread packages/ui/src/components/session-review.tsx
@Astro-Han Astro-Han force-pushed the codex/fix-i92-closeout branch from 0fa3753 to 3443d08 Compare April 23, 2026 01:15
@Astro-Han

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Astro-Han

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request P2 Medium priority upstream Tracked upstream or vendor behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Sync OpenCode upstream v1.14.20 intake

1 participant