Skip to content

chore: upstream sync v1.4.x (252 commits)#196

Merged
terisuke merged 256 commits into
devfrom
feat/upstream-sync-v1-4-4
May 5, 2026
Merged

chore: upstream sync v1.4.x (252 commits)#196
terisuke merged 256 commits into
devfrom
feat/upstream-sync-v1-4-4

Conversation

@terisuke
Copy link
Copy Markdown

@terisuke terisuke commented May 4, 2026

Issue for this PR

Closes #195

Type of change

  • Refactor / code improvement

What does this PR do?

Pulls in 252 commits from upstream anomalyco/opencode dev branch into the fork's dev. Includes the upstream Effect.ts refactor (Effectified ModelsDev, InstanceBootstrap Service, AppRuntime.runPromise removal, workspace adapter rename).

Fork-only adaptations:

  • 5 test files migrated to new fixture helpers (provideTestInstance, disposeAllInstances)
  • 40 ask: async () => {} callbacks in team.test.ts → ask: () => Effect.void for the new Effect-typed AskInput signature
  • Restored 4 fork-specific gpt-5.1-codex models in ALLOWED_MODELS (upstream's new provider.models hook would otherwise filter them out before our guardrail allow-list applies)

Guardrails plugins (4262 LOC) preserved untouched — upstream never had this directory.

How did you verify your code works?

  • bun typecheck: 13/13 packages pass
  • bun --cwd packages/opencode run build: smoke test pass (0.0.0-feat-upstream-sync-v1-4-4-202605040951)
  • bun --cwd packages/opencode test test/plugin/team.test.ts: 42/42 pass (the fork's largest custom test)
  • Full test run: 2376 pass / 13 fail (all 13 are pre-existing tui environment issues in upstream test files, not regressions from this merge)

Screenshots / recordings

N/A (no UI changes).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

kitlangton and others added 30 commits April 29, 2026 09:46
…of type 'reasoning' was provided without its required following item (anomalyco#25007)
Generate linked sourcemaps when building beta releases to help users
debug issues with readable stack traces.
opencode-agent Bot and others added 20 commits May 3, 2026 15:22
…o#25600)

Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com>
Conflict resolutions (handled by Codex CLI route C):
- packages/opencode/src/cli/cmd/run.ts: kept upstream effectCmd conversion + fork cwd canonicalization
- packages/opencode/src/plugin/codex.ts: kept upstream provider-model hook
- packages/opencode/src/session/prompt.ts: merged upstream tracing with fork tool.execute.error hook
- packages/opencode/test/session/prompt.test.ts: kept both upstream v2 event test and fork permission merge test

Preservation:
- packages/guardrails/profile/plugins/*.ts: 7 files, 4262 LOC intact
- packages/plugin/src/index.ts: 337L intact

No fork-only hits for Adaptor/registerAdaptor/AppRuntime/runPromise/tool/bash imports.

Co-Authored-By: Codex CLI (route C) <noreply@openai.com>
- team.test.ts: ask callback now returns Effect.void instead of Promise<void>
                Instance.disposeAll -> disposeAllInstances (fixture helper)
- agent.test.ts: Instance.provide -> provideTestInstance (3 occurrences)
- config.test.ts: Instance.provide -> provideTestInstance (1 occurrence)

Migration follows upstream commit 4c4860f 'Replace Instance.disposeAll/load with fixture helper'
and the Effectified AskInput callback signature.

Refs #195
The packages/sdk/js/build.ts script writes openapi.json to packages/sdk/js/
during code generation and removes it on success, but interrupted builds can
leave the file behind (~500KB). The canonical spec lives at
packages/sdk/openapi.json. Ignore the transient copy so it cannot be
accidentally committed.

Refs #195
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

This pull request has been automatically closed.

@github-actions github-actions Bot closed this May 4, 2026
Upstream's new provider.models hook (anomalyco#25646) filters models by ALLOWED_MODELS
before the guardrail allow-list applies. Without these entries, fork guardrails
that whitelist gpt-5.1-codex, gpt-5.1-codex-mini, gpt-5.1-codex-max, and
gpt-5.2-codex would be silently bypassed when the user is on ChatGPT OAuth.

Refs PR #196 review feedback (MEDIUM).
@terisuke
Copy link
Copy Markdown
Author

terisuke commented May 4, 2026

Addressed MEDIUM review finding: restored 4 fork-specific gpt-5.1-codex models in ALLOWED_MODELS. See latest commit aa36c3b.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

terisuke added a commit that referenced this pull request May 4, 2026
…p + clean-room provenance)

- CRITICAL: reject rename when target file already exists (data loss prevention).
  executeHashlineEdits now stats the rename target before any write and
  refuses if a different file already exists at that path.
- HIGH: resolveAll now detects overlapping line ranges across edits and
  rejects the entire batch atomically. Replace+delete that share even a
  single line, two appends at the same line, etc. were silently corrupting
  the file because the reverse-line apply ran later edits against a
  shifted buffer.
- HIGH: clean-room provenance hardened.
  * HASH_ALPHABET replaced with an independently chosen 16-letter consonant
    set "BCDFGHJKMNPQRSTV" (vowel-free, drops L/W/X/Z for visual clarity).
    Empty-line anchor is now '1#BH' (was '1#ZR').
  * annotateLines separator changed from '|' to U+001E (ASCII Record
    Separator), exported as ANCHOR_CONTENT_SEPARATOR. Path/code-safe
    control char that cannot appear in legitimate file paths or source
    tokens, eliminating downstream parsing ambiguity.
  * Clean-room header copied to every source file (anchor/edit/hash/
    index/types) documenting that constants are independently chosen and
    not derived from any third-party source.
- MEDIUM: empty-file edit consistency. A pre-existing zero-byte file with a
  line-1 edit no longer wrongly rejects (synthesizes the empty-line
  buffer the same way createIfMissing does).
- MEDIUM: errors-as-values for assertValidArgs. Renamed to checkArgs and
  surfaces structural failures as { ok: false, error } instead of
  throwing — callers no longer need try/catch.
- MEDIUM: tempfile entropy. atomicWrite now appends 4 random bytes (8
  hex chars) to the temp suffix on top of pid + timestamp.
- MEDIUM: rename parameter shadow fixed. evaluateRename's parameter
  renamed to renamePath to avoid shadowing the node:fs/promises#rename
  import.

Regression tests added:
  * refuses to overwrite an existing file at the rename target (CRITICAL)
  * rename to the same path as filePath is allowed (no-op move)
  * rejects overlapping replace+delete on the same line (HIGH)
  * rejects two replaces that share even a single line
  * rejects two appends at the same line (ambiguous order)
  * allows non-overlapping edits at adjacent lines
  * accepts a line-1 replace against a pre-existing zero-byte file
  * returns ok:false (no throw) for missing filePath / non-array edits / null args
  * ANCHOR_CONTENT_SEPARATOR is U+001E

Independently chosen alphabet 'BCDFGHJKMNPQRSTV' and Record Separator
(U+001E) — not derived from upstream.

Tests: 54 pass / 0 fail (was 45 pass; 9 new regressions).
Typecheck: 13/13 successful.

Refs PR #196 reviews (code-reviewer + Codex CLI route A)
@terisuke terisuke merged commit 2644445 into dev May 5, 2026
4 of 11 checks passed
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.

test: upstream-sync fork hardening and local deployment E2E plan