Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/computer-mcp-host.sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bee91275a6301e56c64f677125f5d7f38ba7fe0e
941999d411e2a0f1626cc124a3679748804ce2f2
111 changes: 64 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,60 +14,86 @@ jobs:
package:
runs-on: macos-latest
timeout-minutes: 60
outputs:
interop: ${{ steps.interop.outputs.required }}
defaults:
run:
working-directory: plugin
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
path: plugin
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: '3.13'
- name: Install dependency gate tooling
run: brew install jq ripgrep
- name: Validate Swift package
- name: Read the pinned Host revision
id: smoke-host
run: |
revision=$(cat .github/computer-mcp-host.sha)
[[ "$revision" =~ ^[0-9a-f]{40}$ && "$revision" != 0000000000000000000000000000000000000000 ]]
echo "revision=$revision" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: computer-mcp/computer-mcp
ref: ${{ steps.smoke-host.outputs.revision }}
path: host
persist-credentials: false
- uses: ./host/.github/actions/provision-plugin-smoke
- name: Validate and package the plugin
env:
BASE_COMMIT: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
python3 scripts/version.py check
if [[ "$BASE_COMMIT" =~ ^[0-9a-f]{40}$ && "$BASE_COMMIT" != 0000000000000000000000000000000000000000 ]]; then
python3 scripts/version.py check --base "$BASE_COMMIT"
fi
/usr/bin/swift --version
/usr/bin/swift package resolve
git diff --exit-code -- Package.resolved
scripts/verify-swift-codex-release-gate.sh
node --test Tests/schema-import.test.mjs
node scripts/import-schema.mjs --check
/usr/bin/swift format lint --strict --recursive Package.swift Sources Tests
/usr/bin/swift build --build-tests --disable-automatic-resolution
- name: Run Swift tests
timeout-minutes: 10
scripts/test.sh dist
- name: Determine whether exact-pair interop is required
id: interop
env:
PR_BASE: ${{ github.event.pull_request.base.sha }}
run: |
/usr/bin/sw_vers
/usr/sbin/sysctl -n hw.logicalcpu
/usr/bin/swift test --skip-build --disable-automatic-resolution --no-parallel &
test_pid=$!
for ((elapsed = 0; elapsed < 60; elapsed++)); do
if ! /bin/kill -0 "$test_pid" 2>/dev/null; then break; fi
/bin/sleep 1
done
if /bin/kill -0 "$test_pid" 2>/dev/null; then
/bin/ps -p "$test_pid" -o pid=,ppid=,etime=,comm= || true
for process_id in $(/usr/bin/pgrep -P "$test_pid" || true); do
process_command=$(/bin/ps -p "$process_id" -o comm= || true)
case "$process_command" in
*swiftpm-testing*) /usr/bin/sample "$process_id" 1 || true ;;
required=true
if [[ "$GITHUB_EVENT_NAME" == pull_request ]]; then
required=false
git diff --no-renames --name-only -z "$PR_BASE" "$GITHUB_SHA" > .build/interop-paths
while IFS= read -r -d '' path; do
case "$path" in
Documentation/*|README.md|CONTRIBUTING.md|CHANGELOG.md) ;;
*) required=true; break ;;
esac
done
done < .build/interop-paths
fi
wait "$test_pid"
- name: Validate package ownership and publication
run: |
python3 scripts/check-host.py --help
python3 -m unittest discover -s Tests -p 'test_*.py' -v
python3 scripts/check-workflow.py --check-release-workflow
- name: Build relocatable adapter and receipt
run: python3 scripts/package.py --output dist --configuration release
echo "Exact-pair interop required: $required"
echo "required=$required" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: codex-plugin-macos-arm64-${{ github.sha }}
path: |
plugin/dist/codex-plugin-macos-arm64.zip
plugin/dist/receipt.json
if-no-files-found: error
retention-days: 14

interop:
needs: package
if: needs.package.outputs.interop == 'true'
runs-on: macos-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: '3.13'
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: codex-plugin-macos-arm64-${{ github.sha }}
path: dist
- name: Accept the release archive against the pinned Host source
run: |
host_revision=$(cat .github/computer-mcp-host.sha)
Expand All @@ -76,28 +102,19 @@ jobs:
git init "$host_checkout"
git -C "$host_checkout" fetch --no-tags --depth=1 https://github.com/computer-mcp/computer-mcp.git "$host_revision"
git -C "$host_checkout" checkout --detach FETCH_HEAD
python3 scripts/check-host.py --mode container --host-source "$host_checkout" \
--plugin-revision "$GITHUB_SHA" --archive "$PWD/dist/codex-plugin-macos-arm64.zip" \
--receipt "$PWD/dist/receipt.json" --output-directory "$PWD/.build/host-acceptance"
bash scripts/test-interop.sh "$host_checkout" "$host_revision" "$PWD/.build/host-acceptance" "$PWD/dist"
- name: Record registered Host acceptance
if: always()
run: |
report=.build/host-acceptance/runtime/report.json
if [[ -f "$report" ]]; then
cat "$report"
fi
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: codex-plugin-macos-arm64-${{ github.sha }}
path: |
dist/codex-plugin-macos-arm64.zip
dist/receipt.json
if-no-files-found: error
retention-days: 14

validate:
if: always()
needs: [package]
needs: [package, interop]
uses: computer-mcp/github-workflows/.github/workflows/result.yml@d1235cc8d2d86df99770c30b5a0b64469085e931
with:
needs-json: ${{ toJSON(needs) }}
optional-jobs: ${{ needs.package.outputs.interop == 'false' && '["interop"]' || '[]' }}
30 changes: 15 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ external dependencies and credentials.

## Validation

CI runs these checks on macOS; run them before opening a pull request. They need
Node.js, `jq` and `ripgrep`:
Run the same macOS plugin suite as CI before opening a pull request. It needs
Swift, Python 3.12 or newer, Node.js, `jq`, `ripgrep`, and the provisioned
Host fixture for the commit in [the Host pin](.github/computer-mcp-host.sha).

```sh
python3 scripts/version.py check
swift package resolve && git diff --exit-code -- Package.resolved
scripts/verify-swift-codex-release-gate.sh
node --test Tests/schema-import.test.mjs
node scripts/import-schema.mjs --check
swift format lint --strict --recursive Package.swift Sources Tests
swift build --build-tests --disable-automatic-resolution
swift test --skip-build --disable-automatic-resolution --no-parallel
python3 -m unittest discover -s Tests -p 'test_*.py'
python3 scripts/package.py --output OUTPUT_DIRECTORY --configuration release
COMPUTER_MCP_TEST_HOST=/absolute/path/to/fixture scripts/test.sh .build/plugin-validation
```

Exercise help, valid input and invalid input
from outside the checkout. Keep command output contracts and generated resources
covered by tests.
Use a new output directory for each run. The suite builds a release ZIP,
verifies its receipt, and exercises the relocated adapter over MCP with private
Host-service and vendor fixtures. The prebuilt Host then installs the same ZIP
and checks a public catalog call. The tests use no vendor account.

Use `scripts/test.sh --plugin-only .build/plugin-validation` for macOS native
checks while developing without the Host fixture. On Linux or with the
minimum Python 3.11 interpreter, `scripts/test-portable.sh` runs the source
and script checks. The portable checks need Bash, zsh, Git, Node.js,
`jq` and `ripgrep`. Use [the exact-pair gate](Documentation/Reference/Release.md#runtime-acceptance)
when changing the Host-facing contract or implementation.

## Documentation

Expand Down
31 changes: 23 additions & 8 deletions Documentation/Reference/Release.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,28 @@ checks the relocated bytes before runtime acceptance.

## Candidate, Acceptance and Publication

CI runs source checks and `scripts/package.py`, then verifies and relocates the
archive with `scripts/check-package.py`. It uploads the ZIP and native build
receipt as the commit-named candidate artifact. `release.yml` promotes those
accepted CI bytes and receipts without rebuilding. Verification, publication
and catalog notification are separate jobs.
The CI package job runs `scripts/test.sh dist`. This is the same suite
contributors run locally. It checks the source, builds and verifies the release
ZIP and receipt, then exercises the relocated manifest's stdio contribution
with a deterministic App Server and an inherited Host-service MCP fixture.
These cases cover cold discovery, scoped storage, historical migration, lazy
approval recovery, and startup and shutdown of an owned vendor process.
The same suite uses the prebuilt Host at the committed pin to install the ZIP,
enable its stdio contribution and check the public response defined in
[`HostSmoke.json`](../../Tests/Fixtures/HostSmoke.json).

The package job uploads the release ZIP and native receipt as the commit-named
candidate artifact. The interop job downloads those same bytes. It runs on
default-branch pushes, workflow dispatches and pull requests with changes
outside the documentation files. A successful default-branch CI run requires
both jobs. `release.yml` promotes those accepted bytes and receipts without
rebuilding. Verification, publication and catalog notification are separate jobs.

### Runtime acceptance

Use macOS, Swift, Python 3.12 or newer and Git. CI builds the release archive
and runs registered Host acceptance before it uploads the candidate. To run
the same check locally, use a clean Computer MCP checkout at the full commit
Use macOS, Swift, Python 3.12 or newer and Git. CI's interop job exercises
the release archive through registered Host acceptance. To run the same check
locally, use a clean Computer MCP checkout at the full commit
in [the Host pin](../../.github/computer-mcp-host.sha), a clean plugin checkout,
and the ZIP and receipt from that plugin candidate:

Expand All @@ -113,6 +124,10 @@ python3 scripts/check-host.py \
--output-directory "$PWD/.build/host-acceptance"
```

Host CI can pass `--host-revision FULL_SHA` to test its exact candidate against
this plugin. The driver still requires a clean Host checkout at that SHA and
a clean plugin checkout at `--plugin-revision`.

The driver checks both Git checkouts, exports Host source into the new output
directory, and builds the registered fixture and execution bootstrap against
the committed Host dependency lock. It verifies and relocates the ZIP before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,26 @@ import Testing
struct CodexAppServerProcessTransportTests {
@Test(.timeLimit(.minutes(1)))
func supervisorExitDoesNotProveChildGroupCleanup() async throws {
let workspace = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
try FileManager.default.createDirectory(at: workspace, withIntermediateDirectories: true)
defer { try? FileManager.default.removeItem(at: workspace) }
let hold = workspace.appendingPathComponent("hold")
try Data().write(to: hold)
let transport = try ManagedLineProcess(
configuration: .init(
executable: "/usr/bin/python3",
arguments: [
"-c",
"import os,time; print(os.getpid(),flush=True); os.close(1); os.close(2); time.sleep(3)",
"""
import os, time
print(os.getpid(), flush=True)
os.close(1)
os.close(2)
while os.path.exists("hold"):
time.sleep(0.01)
""",
],
workingDirectory: FileManager.default.temporaryDirectory,
workingDirectory: workspace,
terminationGraceMilliseconds: 10, killGraceMilliseconds: 100))
var lines = transport.inboundLines.makeAsyncIterator()
let ready = try #require(try await lines.next())
Expand All @@ -34,6 +46,7 @@ struct CodexAppServerProcessTransportTests {
await transport.close()
#expect(Darwin.kill(child, 0) == 0)
#expect(await transport.snapshot().cleanupConfirmed == false)
try FileManager.default.removeItem(at: hold)
let cleanupDeadline = ContinuousClock.now + .seconds(4)
while await transport.snapshot().cleanupConfirmed != true, ContinuousClock.now < cleanupDeadline
{
Expand Down
Loading
Loading