Skip to content

Commit 0b67621

Browse files
authored
Merge branch 'main' into feat/opencode-context-hooks
2 parents 63be298 + 909051c commit 0b67621

264 files changed

Lines changed: 36043 additions & 4201 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitattributes‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# Shell scripts must stay LF: with git's Windows default (core.autocrlf=true)
2+
# they check out as CRLF and bash inside the build containers rejects them.
3+
*.sh text eol=lf
4+
15
# Vendored tree-sitter grammars — machine-generated, hide from stats and diffs
26
internal/cbm/vendored/grammars/**/parser.c linguist-generated=true diff=false
37
internal/cbm/vendored/grammars/**/scanner.c linguist-generated=true diff=false
8+
9+
# Shell entrypoints must check out LF everywhere: a CRLF shebang line breaks
10+
# them under WSL/MSYS (`bash\r: no such file`). The *.sh rule covers scripts;
11+
# the git hooks are extensionless and need explicit entries. (#1272)
12+
scripts/git-hooks/commit-msg text eol=lf
13+
scripts/hooks/pre-commit text eol=lf

‎.github/workflows/_build.yml‎

Lines changed: 293 additions & 122 deletions
Large diffs are not rendered by default.

‎.github/workflows/_lint.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ permissions:
1111
jobs:
1212
lint:
1313
runs-on: ubuntu-latest
14-
timeout-minutes: 15
14+
# 15 min proved too tight on a slow runner day and a timed-out lint reads
15+
# as "cancelled", which the release graph must treat as a hard stop; keep
16+
# a bound, but one only a genuine hang can hit (normal runtime ~5 min).
17+
timeout-minutes: 30
1518
steps:
1619
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1720

‎.github/workflows/_smoke.yml‎

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Reusable: smoke test every binary (standard + UI, all platforms)
1+
# Reusable: smoke test shipped release binaries on all platforms
22
name: Smoke
33

44
on:
@@ -8,7 +8,6 @@ on:
88
description: 'Smoke the shipped binaries on the broad platform matrix (extra OS versions) instead of the core set'
99
type: boolean
1010
default: false
11-
1211
permissions:
1312
contents: read
1413

@@ -72,16 +71,11 @@ jobs:
7271
WIN=$(jq -cn --argjson a "$CORE_WIN" '$a')
7372
PORTABLE=$(jq -cn --argjson a "$CORE_PORTABLE" '$a')
7473
fi
75-
# Expand each OS entry over both variants into a FLAT include list so
76-
# every {os,variant} runs as its own job. A {variant:[...],include:$LIST}
77-
# matrix collapses under GitHub's include-merge (later os entries
78-
# overwrite the variant combos last-wins), which silently dropped every
79-
# OS except the last — e.g. only windows-11-arm ran, never windows-latest.
80-
# Building the cartesian explicitly avoids that.
81-
VARIANTS='["standard","ui"]'
82-
UNIX_M=$(jq -cn --argjson a "$UNIX" --argjson v "$VARIANTS" '{include:[$a[] as $o | $v[] as $t | ($o + {variant:$t})]}')
83-
WIN_M=$(jq -cn --argjson a "$WIN" --argjson v "$VARIANTS" '{include:[$a[] as $o | $v[] as $t | ($o + {variant:$t})]}')
84-
PORTABLE_M=$(jq -cn --argjson a "$PORTABLE" --argjson v "$VARIANTS" '{include:[$a[] as $o | $v[] as $t | ($o + {variant:$t})]}')
74+
# One composition ships; the wrappers assert the embedded UI themselves
75+
# (SMOKE_REQUIRE_UI in scripts/ci/smoke-artifact.sh and below).
76+
UNIX_M=$(jq -cn --argjson a "$UNIX" '{include:$a}')
77+
WIN_M=$(jq -cn --argjson a "$WIN" '{include:$a}')
78+
PORTABLE_M=$(jq -cn --argjson a "$PORTABLE" '{include:$a}')
8579
echo "unix=$UNIX_M" >> "$GITHUB_OUTPUT"
8680
echo "windows=$WIN_M" >> "$GITHUB_OUTPUT"
8781
echo "portable=$PORTABLE_M" >> "$GITHUB_OUTPUT"
@@ -107,9 +101,8 @@ jobs:
107101

108102
- name: Extract release artifact
109103
run: |
110-
SUFFIX=${{ matrix.variant == 'ui' && '-ui' || '' }}
111104
mkdir -p "$RUNNER_TEMP/cbm-artifact"
112-
tar -xzf codebase-memory-mcp${SUFFIX}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz \
105+
tar -xzf codebase-memory-mcp-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz \
113106
-C "$RUNNER_TEMP/cbm-artifact"
114107
chmod +x "$RUNNER_TEMP/cbm-artifact/codebase-memory-mcp"
115108
@@ -121,10 +114,10 @@ jobs:
121114
# the wrapper (no env isolation, no user-PATH guard, fixed port).
122115
- name: Smoke test (shared wrapper)
123116
run: |
124-
scripts/smoke-local.sh \
125-
"$RUNNER_TEMP/cbm-artifact/codebase-memory-mcp" ${{ matrix.variant }}
117+
scripts/smoke-local.sh "$RUNNER_TEMP/cbm-artifact/codebase-memory-mcp"
126118
env:
127119
CBM_SMOKE_ARTIFACT_DIR: ${{ runner.temp }}/cbm-artifact
120+
SMOKE_REQUIRE_UI: "1"
128121

129122
- name: Security audits
130123
run: |
@@ -133,8 +126,8 @@ jobs:
133126
scripts/security-install.sh "$BIN"
134127
scripts/security-network.sh "$BIN"
135128
136-
- name: MCP robustness test (linux-amd64 standard only)
137-
if: matrix.variant == 'standard' && matrix.goos == 'linux' && matrix.goarch == 'amd64'
129+
- name: MCP robustness test (selected linux-amd64 runtime)
130+
if: matrix.goos == 'linux' && matrix.goarch == 'amd64'
138131
run: |
139132
BIN="$RUNNER_TEMP/cbm-artifact/codebase-memory-mcp"
140133
scripts/security-fuzz.sh "$BIN"
@@ -200,14 +193,13 @@ jobs:
200193
- name: Extract release artifact
201194
shell: msys2 {0}
202195
run: |
203-
SUFFIX=${{ matrix.variant == 'ui' && '-ui' || '' }}
204196
ARCH=${{ matrix.arch }}
205197
ARTIFACT_DIR="$(cygpath -u "$RUNNER_TEMP")/cbm-artifact"
206198
mkdir -p "$ARTIFACT_DIR"
207-
unzip -o "codebase-memory-mcp${SUFFIX}-windows-${ARCH}.zip" -d "$ARTIFACT_DIR"
199+
unzip -o "codebase-memory-mcp-windows-${ARCH}.zip" -d "$ARTIFACT_DIR"
208200
test -s "$ARTIFACT_DIR/codebase-memory-mcp.exe"
209-
# ONE binary per platform: a payload sibling would mean the
210-
# AV-flagged launcher stub came back.
201+
# ONE executable per runtime set: a payload sibling would mean the
202+
# removed launcher split came back.
211203
test ! -e "$ARTIFACT_DIR/codebase-memory-mcp.payload.exe"
212204
# Pre-flight the image from a profile-rooted directory: the shared
213205
# runner workspace is deliberately not a valid install root.
@@ -231,7 +223,7 @@ jobs:
231223
shell: msys2 {0}
232224
env:
233225
SMOKE_ARCH: ${{ matrix.arch }}
234-
SMOKE_VARIANT: ${{ matrix.variant }}
226+
SMOKE_REQUIRE_UI: "1"
235227
run: |
236228
export CBM_SMOKE_ARTIFACT_DIR="$(cygpath -u "$RUNNER_TEMP")/cbm-artifact"
237229
bash test-infrastructure/vm/vm-smoke.sh
@@ -293,9 +285,8 @@ jobs:
293285

294286
- name: Extract release artifact
295287
run: |
296-
SUFFIX=${{ matrix.variant == 'ui' && '-ui' || '' }}
297288
mkdir -p "$RUNNER_TEMP/cbm-artifact"
298-
tar -xzf codebase-memory-mcp${SUFFIX}-linux-${{ matrix.arch }}-portable.tar.gz \
289+
tar -xzf codebase-memory-mcp-linux-${{ matrix.arch }}-portable.tar.gz \
299290
-C "$RUNNER_TEMP/cbm-artifact"
300291
chmod +x "$RUNNER_TEMP/cbm-artifact/codebase-memory-mcp"
301292
@@ -306,10 +297,10 @@ jobs:
306297
# exactly the phases it most needs to run.
307298
- name: Smoke test (shared wrapper)
308299
run: |
309-
scripts/smoke-local.sh \
310-
"$RUNNER_TEMP/cbm-artifact/codebase-memory-mcp" ${{ matrix.variant }}
300+
scripts/smoke-local.sh "$RUNNER_TEMP/cbm-artifact/codebase-memory-mcp"
311301
env:
312302
CBM_SMOKE_ARTIFACT_DIR: ${{ runner.temp }}/cbm-artifact
303+
SMOKE_REQUIRE_UI: "1"
313304

314305
# The -portable binary is what all linux install/update paths now deliver;
315306
# it MUST start on old glibc (Debian 11 / RHEL 8 / Ubuntu 20.04). Runs it

‎.github/workflows/_soak.yml‎

Lines changed: 124 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
description: 'Version string for build'
2121
type: string
2222
default: ''
23+
use_release_artifacts:
24+
description: 'Soak the already selected binaries-* artifacts instead of rebuilding quick-lane binaries'
25+
type: boolean
26+
default: false
2327

2428
permissions:
2529
contents: read
@@ -64,12 +68,33 @@ jobs:
6468
if: startsWith(matrix.os, 'ubuntu')
6569
run: sudo apt-get update && sudo apt-get install -y zlib1g-dev python3 git
6670
- name: Build
71+
if: ${{ !inputs.use_release_artifacts }}
6772
run: scripts/build.sh ${{ inputs.version && format('--version {0}', inputs.version) || '' }} CC=${{ matrix.cc }} CXX=${{ matrix.cxx }}
73+
- name: Download selected release container
74+
if: ${{ inputs.use_release_artifacts }}
75+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
76+
with:
77+
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
78+
path: ${{ runner.temp }}/cbm-selected-container
79+
- name: Extract selected release executable
80+
if: ${{ inputs.use_release_artifacts }}
81+
run: |
82+
mkdir -p "$RUNNER_TEMP/cbm-selected-artifact"
83+
tar -xzf "$RUNNER_TEMP/cbm-selected-container/codebase-memory-mcp-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz" \
84+
-C "$RUNNER_TEMP/cbm-selected-artifact" codebase-memory-mcp
85+
chmod +x "$RUNNER_TEMP/cbm-selected-artifact/codebase-memory-mcp"
86+
"$RUNNER_TEMP/cbm-selected-artifact/codebase-memory-mcp" --version
6887
# The soak SEQUENCE and its guards live in the ONE canonical entry
6988
# scripts/soak-legs.sh — never in workflow YAML. Leg selection is a
7089
# workflow input so a long #581-only run needs no separate workflow.
7190
- name: Soak legs (${{ inputs.legs }}, ${{ inputs.duration_minutes }} min each)
72-
run: scripts/soak-legs.sh --legs "${{ inputs.legs }}" build/c/codebase-memory-mcp ${{ inputs.duration_minutes }}
91+
env:
92+
SELECTED_BINARY: ${{ runner.temp }}/cbm-selected-artifact/codebase-memory-mcp
93+
USE_RELEASE_ARTIFACTS: ${{ inputs.use_release_artifacts }}
94+
run: |
95+
binary=build/c/codebase-memory-mcp
96+
test "$USE_RELEASE_ARTIFACTS" != true || binary="$SELECTED_BINARY"
97+
scripts/soak-legs.sh --legs "${{ inputs.legs }}" "$binary" ${{ inputs.duration_minutes }}
7398
- name: Upload metrics
7499
if: always()
75100
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
@@ -104,6 +129,7 @@ jobs:
104129
make
105130
git
106131
coreutils
132+
unzip
107133
# Same protected root the test legs and the VM soak use. Without it the
108134
# soak ran under the runner's inherited LocalAppData\Temp ACLs while the
109135
# local soak ran hardened — the two venues were soaking different shapes.
@@ -115,8 +141,24 @@ jobs:
115141
-ProtectDir (Join-Path $env:GITHUB_WORKSPACE "build\c")
116142
"CBM_CI_TEMP_ROOT=$root" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
117143
- name: Build
144+
if: ${{ !inputs.use_release_artifacts }}
118145
shell: msys2 {0}
119146
run: scripts/build.sh ${{ inputs.version && format('--version {0}', inputs.version) || '' }} CC=clang CXX=clang++
147+
- name: Download selected release container
148+
if: ${{ inputs.use_release_artifacts }}
149+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
150+
with:
151+
name: binaries-windows-amd64
152+
path: ${{ runner.temp }}/cbm-selected-container
153+
- name: Extract selected release executable
154+
if: ${{ inputs.use_release_artifacts }}
155+
shell: msys2 {0}
156+
run: |
157+
ARTIFACT_DIR="$(cygpath -u "$RUNNER_TEMP")/cbm-selected-artifact"
158+
mkdir -p "$ARTIFACT_DIR"
159+
unzip -q "$(cygpath -u "$RUNNER_TEMP")/cbm-selected-container/codebase-memory-mcp-windows-amd64.zip" \
160+
codebase-memory-mcp.exe -d "$ARTIFACT_DIR"
161+
"$ARTIFACT_DIR/codebase-memory-mcp.exe" --version
120162
# Both release-gating legs via the ONE canonical soak entry; only the
121163
# protected-TEMP provisioning is venue text. soak-legs.sh resolves .exe.
122164
- name: Soak legs (${{ inputs.legs }}, ${{ inputs.duration_minutes }} min each)
@@ -125,7 +167,11 @@ jobs:
125167
export TEMP="$(cygpath -m "$CBM_CI_TEMP_ROOT")"
126168
export TMP="$TEMP"
127169
export TMPDIR="$(cygpath -u "$CBM_CI_TEMP_ROOT")"
128-
scripts/soak-legs.sh --legs "${{ inputs.legs }}" build/c/codebase-memory-mcp ${{ inputs.duration_minutes }}
170+
binary=build/c/codebase-memory-mcp
171+
if [ "${{ inputs.use_release_artifacts }}" = true ]; then
172+
binary="$(cygpath -u "$RUNNER_TEMP")/cbm-selected-artifact/codebase-memory-mcp.exe"
173+
fi
174+
scripts/soak-legs.sh --legs "${{ inputs.legs }}" "$binary" ${{ inputs.duration_minutes }}
129175
- name: Upload metrics
130176
if: always()
131177
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
@@ -161,6 +207,7 @@ jobs:
161207
make
162208
git
163209
coreutils
210+
unzip
164211
# Same protected root the test legs and the VM soak use. Without it the
165212
# soak ran under the runner's inherited LocalAppData\Temp ACLs while the
166213
# local soak ran hardened — the two venues were soaking different shapes.
@@ -172,8 +219,24 @@ jobs:
172219
-ProtectDir (Join-Path $env:GITHUB_WORKSPACE "build\c")
173220
"CBM_CI_TEMP_ROOT=$root" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
174221
- name: Build
222+
if: ${{ !inputs.use_release_artifacts }}
175223
shell: msys2 {0}
176224
run: scripts/build.sh ${{ inputs.version && format('--version {0}', inputs.version) || '' }} CC=clang CXX=clang++
225+
- name: Download selected release container
226+
if: ${{ inputs.use_release_artifacts }}
227+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
228+
with:
229+
name: binaries-windows-arm64
230+
path: ${{ runner.temp }}/cbm-selected-container
231+
- name: Extract selected release executable
232+
if: ${{ inputs.use_release_artifacts }}
233+
shell: msys2 {0}
234+
run: |
235+
ARTIFACT_DIR="$(cygpath -u "$RUNNER_TEMP")/cbm-selected-artifact"
236+
mkdir -p "$ARTIFACT_DIR"
237+
unzip -q "$(cygpath -u "$RUNNER_TEMP")/cbm-selected-container/codebase-memory-mcp-windows-arm64.zip" \
238+
codebase-memory-mcp.exe -d "$ARTIFACT_DIR"
239+
"$ARTIFACT_DIR/codebase-memory-mcp.exe" --version
177240
# Both release-gating legs via the ONE canonical soak entry; only the
178241
# protected-TEMP provisioning is venue text. soak-legs.sh resolves .exe.
179242
- name: Soak legs (${{ inputs.legs }}, ${{ inputs.duration_minutes }} min each)
@@ -182,7 +245,11 @@ jobs:
182245
export TEMP="$(cygpath -m "$CBM_CI_TEMP_ROOT")"
183246
export TMP="$TEMP"
184247
export TMPDIR="$(cygpath -u "$CBM_CI_TEMP_ROOT")"
185-
scripts/soak-legs.sh --legs "${{ inputs.legs }}" build/c/codebase-memory-mcp ${{ inputs.duration_minutes }}
248+
binary=build/c/codebase-memory-mcp
249+
if [ "${{ inputs.use_release_artifacts }}" = true ]; then
250+
binary="$(cygpath -u "$RUNNER_TEMP")/cbm-selected-artifact/codebase-memory-mcp.exe"
251+
fi
252+
scripts/soak-legs.sh --legs "${{ inputs.legs }}" "$binary" ${{ inputs.duration_minutes }}
186253
- name: Upload metrics
187254
if: always()
188255
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
@@ -198,7 +265,61 @@ jobs:
198265
path: soak-results-query-leak/
199266
retention-days: 14
200267

268+
# Portable Linux is a separate immutable product tuple. It participates when
269+
# a caller supplies selected release artifacts; the source-building nightly
270+
# retains its historical matrix and has no upstream binaries-* artifacts.
271+
soak-quick-linux-portable:
272+
if: ${{ inputs.use_release_artifacts }}
273+
strategy:
274+
fail-fast: false
275+
matrix:
276+
include:
277+
- arch: amd64
278+
runner: ubuntu-latest
279+
- arch: arm64
280+
runner: ubuntu-24.04-arm
281+
runs-on: ${{ matrix.runner }}
282+
timeout-minutes: 560
283+
steps:
284+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
285+
- name: Install soak dependencies
286+
run: sudo apt-get update && sudo apt-get install -y python3 git
287+
- name: Download selected portable release container
288+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
289+
with:
290+
name: binaries-linux-${{ matrix.arch }}-portable
291+
path: ${{ runner.temp }}/cbm-selected-container
292+
- name: Extract selected portable executable
293+
run: |
294+
mkdir -p "$RUNNER_TEMP/cbm-selected-artifact"
295+
tar -xzf "$RUNNER_TEMP/cbm-selected-container/codebase-memory-mcp-linux-${{ matrix.arch }}-portable.tar.gz" \
296+
-C "$RUNNER_TEMP/cbm-selected-artifact" codebase-memory-mcp
297+
chmod +x "$RUNNER_TEMP/cbm-selected-artifact/codebase-memory-mcp"
298+
"$RUNNER_TEMP/cbm-selected-artifact/codebase-memory-mcp" --version
299+
- name: Soak selected portable legs (${{ inputs.legs }}, ${{ inputs.duration_minutes }} min each)
300+
run: |
301+
scripts/soak-legs.sh --legs "${{ inputs.legs }}" \
302+
"$RUNNER_TEMP/cbm-selected-artifact/codebase-memory-mcp" \
303+
${{ inputs.duration_minutes }}
304+
- name: Upload metrics
305+
if: always()
306+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
307+
with:
308+
name: soak-quick-linux-${{ matrix.arch }}-portable
309+
path: soak-results/
310+
retention-days: 14
311+
- name: Upload query-leak metrics
312+
if: always()
313+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
314+
with:
315+
name: soak-query-leak-linux-${{ matrix.arch }}-portable
316+
path: soak-results-query-leak/
317+
retention-days: 14
318+
201319
soak-asan:
320+
# Supplemental source-built instrumentation. This can find memory bugs but
321+
# is not evidence that the selected release bytes were soaked; the quick
322+
# jobs above own that release gate when use_release_artifacts=true.
202323
if: ${{ inputs.run_asan }}
203324
strategy:
204325
fail-fast: false

0 commit comments

Comments
 (0)