Repository navigation
174 lines (158 loc) · 6.93 KB
/
Copy pathoar-integration.yml
File metadata and controls
174 lines (158 loc) · 6.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: OAR live integration
"on":
pull_request:
types: [opened, reopened, synchronize, ready_for_review, labeled, unlabeled]
paths:
- .github/workflows/oar-integration.yml
- .github/actions/setup-review-gateway/**
- projects/tools/openshell-agent-runner/src/**
- projects/tools/openshell-agent-runner/pyproject.toml
- projects/tools/openshell-agent-runner/uv.lock
- projects/tools/openshell-agent-runner/tests/fixtures/pipeline-integration/**
push:
branches: [main]
paths:
- .github/workflows/oar-integration.yml
- .github/actions/setup-review-gateway/**
- projects/tools/openshell-agent-runner/src/**
- projects/tools/openshell-agent-runner/pyproject.toml
- projects/tools/openshell-agent-runner/uv.lock
- projects/tools/openshell-agent-runner/tests/fixtures/pipeline-integration/**
workflow_dispatch:
permissions: {}
concurrency:
group: oar-integration-${{ github.ref }}
cancel-in-progress: true
jobs:
bypass:
name: Report manual live OAR bypass
if: >-
vars.OAR_SKIP_LIVE == 'true' ||
contains(github.event.pull_request.labels.*.name, 'skip-oar-live')
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Explain bypass
env:
REPOSITORY_BYPASS: ${{ vars.OAR_SKIP_LIVE == 'true' }}
run: |
if [[ "$REPOSITORY_BYPASS" == 'true' ]]; then
reason='Repository variable OAR_SKIP_LIVE=true.'
else
reason='PR label skip-oar-live.'
fi
echo "::warning::Live OAR integration manually bypassed. $reason"
{
echo '## Live OAR integration manually bypassed'
echo
echo "$reason"
echo 'No live execution was verified. Offline functional, package, and runtime checks remain enabled.'
} >> "$GITHUB_STEP_SUMMARY"
integration:
name: Run installed OAR through OpenShell
# Candidate OAR code runs on the host: restrict secrets to trusted branches.
if: >-
vars.OAR_SKIP_LIVE != 'true' &&
!contains(github.event.pull_request.labels.*.name, 'skip-oar-live') &&
((github.event_name == 'pull_request' &&
!github.event.pull_request.draft &&
github.event.pull_request.head.repo.full_name == github.repository &&
github.actor != 'dependabot[bot]') ||
(github.event_name != 'pull_request' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)))
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout tested revision
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- name: Set up uv and Python
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: "0.12.5"
python-version: "3.12"
enable-cache: true
cache-dependency-glob: projects/tools/openshell-agent-runner/uv.lock
- name: Install the wheel and prepare the contract input
working-directory: projects/tools/openshell-agent-runner
env:
REVIEW_MODEL: ${{ secrets.MODEL_ID_TOP }}
run: |
uv build --no-sources --out-dir "$RUNNER_TEMP/wheels"
uv venv "$RUNNER_TEMP/oar-venv"
wheel=("$RUNNER_TEMP"/wheels/*.whl)
test "${#wheel[@]}" -eq 1
uv pip install --python "$RUNNER_TEMP/oar-venv/bin/python" "${wheel[0]}"
oar="$RUNNER_TEMP/oar-venv/bin/oar"
"$oar" init "$RUNNER_TEMP/profiles" --profile code-reviewer \
--model "$REVIEW_MODEL" --thinking off
cp tests/fixtures/pipeline-integration/* "$RUNNER_TEMP/profiles/code-reviewer/"
"$oar" validate "$RUNNER_TEMP/profiles/code-reviewer"
mkdir -p "$RUNNER_TEMP/oar-integration"
printf 'Input for workflow run %s, attempt %s.\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" \
> "$RUNNER_TEMP/oar-integration/input.txt"
- name: Start ephemeral gateway
id: gateway
uses: ./.github/actions/setup-review-gateway
with:
api-key: ${{ secrets.INFERENCE_API_KEY }}
base-url: ${{ secrets.INFERENCE_BASE_URL }}
model: ${{ secrets.MODEL_ID_TOP }}
- name: Exercise the installed CLI
run: |
"$RUNNER_TEMP/oar-venv/bin/oar" run "$RUNNER_TEMP/profiles/code-reviewer" \
--task echo-input --input "$RUNNER_TEMP/oar-integration/input.txt" \
--prompt-var "marker=$GITHUB_RUN_ID" --gateway openshell \
--timeout-seconds 300 --output "$RUNNER_TEMP/oar-integration/result.json" \
> "$RUNNER_TEMP/oar-integration/run.log" 2>&1
- name: Verify transfer, prompt substitution, and structured output
run: |
python3 - <<'PY'
import json
import os
from pathlib import Path
results = Path(os.environ["RUNNER_TEMP"]) / "oar-integration"
result = json.loads((results / "result.json").read_text())
assert result["content"] == (results / "input.txt").read_text().strip(), result
assert result["marker"] == os.environ["GITHUB_RUN_ID"], result
PY
- name: Verify sandbox cleanup
if: ${{ !cancelled() && steps.gateway.outcome == 'success' }}
run: |
openshell sandbox list --gateway openshell --names \
> "$RUNNER_TEMP/oar-integration/remaining-sandboxes.txt"
test ! -s "$RUNNER_TEMP/oar-integration/remaining-sandboxes.txt"
- name: Capture safe diagnostics
if: always() && steps.gateway.outcome != 'skipped'
run: |
openshell --version > "$RUNNER_TEMP/oar-integration/openshell-version.txt" 2>&1 || true
openshell status > "$RUNNER_TEMP/oar-integration/gateway-status.txt" 2>&1 || true
- name: Stop gateway
if: always() && steps.gateway.outcome != 'skipped'
run: systemctl --user stop openshell-gateway.service
- name: Upload integration evidence
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: oar-live-integration
path: ${{ runner.temp }}/oar-integration
if-no-files-found: warn
retention-days: 14
- name: Summarize integration check
if: always()
env:
OUTCOME: ${{ job.status }}
run: |
{
echo '## OAR live integration'
echo
echo "Outcome: **$OUTCOME**"
echo
echo 'An installed wheel ran through a real OpenShell gateway and inference route.'
echo 'The check verifies input transfer, prompt substitution, schema-validated output, and sandbox cleanup.'
echo 'It verifies execution contracts, not reviewer judgment or PR content.'
} >> "$GITHUB_STEP_SUMMARY"