Repository navigation
431 lines (420 loc) · 19.7 KB
/
Copy pathformal.yml
File metadata and controls
431 lines (420 loc) · 19.7 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
name: Formal
# Runs the formal/ model checks (TLC for the TLA+ specs, Lean/lake for the proofs).
# - schedule / workflow_dispatch: every model with every config, slow ones included.
# - pull_request: only the models whose spec or modeled source changed, with
# FORMAL_FAST=1 (each check.sh skips its configs that take over ~10 min).
# Not a required check (#5399): a red run names the model whose EXPECT table or
# proof no longer matches the code.
on:
schedule:
- cron: "0 6 * * *" # Daily at 6 AM UTC
workflow_dispatch: {}
pull_request:
# Coarse gate: the union of the per-model filters in the plan job below.
# Keep the two lists in sync.
paths:
- ".github/workflows/formal.yml"
- "formal/**"
- "src/browser/features/ChatInput/composerDraftText.ts"
- "src/browser/features/ChatInput/index.tsx"
- "src/browser/features/ChatInput/useCreationWorkspace.ts"
- "src/browser/features/Messages/ChatBarrier/RetryBarrier.tsx"
- "src/browser/features/Messages/ChatBarrier/StreamingBarrier.tsx"
- "src/browser/hooks/useAIViewKeybinds.ts"
- "src/browser/stores/DraftStore.ts"
- "src/browser/utils/chatCommands.ts"
- "src/browser/utils/commands/sources.ts"
- "src/browser/utils/compaction/handler.ts"
- "src/browser/utils/stopStream.ts"
- "src/common/orpc/schemas/api.ts"
- "src/common/utils/messages/retryEligibility.ts"
- "src/common/utils/planStorage.ts"
- "src/common/utils/workflowRetryEligibility.ts"
- "src/constants/agentMessaging.ts"
- "src/constants/runtimeReads.ts"
- "src/node/config/index.ts"
- "src/node/config/installationIdentity.ts"
- "src/node/runtime/RemoteRuntime.ts"
- "src/node/runtime/Runtime.ts"
- "src/node/runtime/SSH2ConnectionPool.ts"
- "src/node/runtime/SSHRuntime.ts"
- "src/node/runtime/backgroundCommands.ts"
- "src/node/runtime/execFileIO.ts"
- "src/node/runtime/runtimeFactory.ts"
- "src/node/runtime/sshBackoff.ts"
- "src/node/runtime/sshConnectionPool.ts"
- "src/node/runtime/transports/**"
- "src/node/services/*ompact*.ts"
- "src/node/services/agentPeerMessageBroker.ts"
- "src/node/services/agentSession.ts"
- "src/node/services/aiService.ts"
- "src/node/services/backgroundProcessExecutor.ts"
- "src/node/services/backgroundProcessManager.ts"
- "src/node/services/di/layers/core.ts"
- "src/node/services/draftService.ts"
- "src/node/services/goalContinuationPolicy.ts"
- "src/node/services/heartbeatService.ts"
- "src/node/services/history*.ts"
- "src/node/services/idleDispatcher.ts"
- "src/node/services/initStateManager.ts"
- "src/node/services/messageQueue.ts"
- "src/node/services/retryManager.ts"
- "src/node/services/sendIds.ts"
- "src/node/services/streamManager.ts"
- "src/node/services/taskHandleStore.ts"
- "src/node/services/taskService.ts"
- "src/node/services/tools/bash.ts"
- "src/node/services/tools/task_message_parent.ts"
- "src/node/services/tools/task_message_sibling.ts"
- "src/node/services/tools/task_send_message.ts"
- "src/node/services/turnCoordinator.ts"
- "src/node/services/turnRequestBuilder.ts"
- "src/node/services/utils/fileChangeTracker.ts"
- "src/node/services/utils/forkOrchestrator.ts"
- "src/node/services/workflows/**"
- "src/node/services/workspaceGoalService.ts"
- "src/node/services/workspaceService.ts"
- "src/node/services/workspaceTurnManager.ts"
- "src/node/services/workspaceUseLeases.ts"
- "src/node/utils/concurrency/**"
- "src/node/utils/main/crossProcessLock.ts"
- "src/node/utils/runtime/helpers.ts"
- "src/node/utils/runtime/planLocation.ts"
- "src/node/utils/writeFileAtomic.ts"
- "src/node/worktree/WorktreeManager.ts"
- "vscode/src/webview/App.tsx"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
# TLC is built from a pinned tlaplus commit: 1.7.4, the last immutable release, rejects the
# -noGenerateSpecTE and -dumpTrace flags the check.sh scripts pass, and the 1.8.0 jars are
# rolling (republished about daily) or thin Maven snapshots that expire. The source archive
# is sha256-pinned; the built jar is not byte-reproducible, so it is cached per commit.
# To bump: pick a tlaplus master commit, update both values, and run this workflow by hand.
TLAPLUS_COMMIT: cc6d7039eb105bcb9e6ea81d887b3c9f0ad28801
TLAPLUS_SRC_SHA256: 32c708f09abb02fb24d4b2a41703267635b3ed0912d336a3b604116122a01ea7
ANT_VERSION: 1.10.15
ANT_SHA512: d78427aff207592c024ff1552dc04f7b57065a195c42d398fcffe7a0145e8d00cd46786f5aa52e77ab0fdf81334f065eb8011eecd2b48f7228e97ff4cb20d16c
# The Lean toolchain itself comes from each model's lean-toolchain file.
ELAN_VERSION: 4.2.4
ELAN_SHA256: 42b94d4244e8353142c456ec0e4ca6528fd898a6c604d4059f494e706e431f63
jobs:
plan:
name: Plan
runs-on: ubuntu-latest
outputs:
models: ${{ steps.models.outputs.models }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
if: github.event_name == 'pull_request'
with:
# One filter per formal/ model: its own directory plus the source files its spec cites.
filters: |
workflow:
- '.github/workflows/formal.yml'
background-processes:
- 'formal/background-processes/**'
- 'src/node/runtime/backgroundCommands.ts'
- 'src/node/services/backgroundProcessExecutor.ts'
- 'src/node/services/backgroundProcessManager.ts'
- 'src/node/services/di/layers/core.ts'
- 'src/node/services/tools/bash.ts'
- 'src/node/services/workspaceService.ts'
- 'src/node/services/workspaceUseLeases.ts'
compaction:
- 'formal/compaction/**'
- 'src/node/services/*ompact*.ts'
- 'src/node/services/agentSession.ts'
- 'src/node/services/historyService.ts'
- 'src/node/utils/concurrency/fileLock.ts'
composer-drafts:
- 'formal/composer-drafts/**'
- 'src/browser/features/ChatInput/composerDraftText.ts'
- 'src/browser/features/ChatInput/index.tsx'
- 'src/browser/features/ChatInput/useCreationWorkspace.ts'
- 'src/browser/stores/DraftStore.ts'
- 'src/browser/utils/chatCommands.ts'
- 'src/node/services/agentSession.ts'
- 'src/node/services/draftService.ts'
- 'src/node/services/historyService.ts'
- 'src/node/services/messageQueue.ts'
- 'src/node/services/sendIds.ts'
- 'src/node/services/workspaceService.ts'
delegated-turns:
- 'formal/delegated-turns/**'
- 'src/node/services/agentSession.ts'
- 'src/node/services/taskHandleStore.ts'
- 'src/node/services/taskService.ts'
- 'src/node/services/workspaceService.ts'
- 'src/node/services/workspaceTurnManager.ts'
filelock:
- 'formal/filelock/**'
- 'src/node/utils/concurrency/fileLock.ts'
- 'src/node/utils/concurrency/processLiveness.ts'
- 'src/node/utils/main/crossProcessLock.ts'
history-crash:
- 'formal/history-crash/**'
- 'src/node/services/agentSession.ts'
- 'src/node/services/aiService.ts'
- 'src/node/services/history*.ts'
- 'src/node/services/streamManager.ts'
- 'src/node/services/turnRequestBuilder.ts'
- 'src/node/utils/concurrency/fileLock.ts'
- 'src/node/utils/writeFileAtomic.ts'
history-locator:
- 'formal/history-locator/**'
- 'src/node/services/history*.ts'
message-queue:
- 'formal/message-queue/**'
- 'src/node/services/agentSession.ts'
- 'src/node/services/messageQueue.ts'
- 'src/node/services/taskService.ts'
- 'src/node/services/workspaceService.ts'
peer-limits:
- 'formal/peer-limits/**'
- 'src/constants/agentMessaging.ts'
- 'src/node/services/agentPeerMessageBroker.ts'
- 'src/node/services/taskService.ts'
- 'src/node/services/tools/task_message_parent.ts'
- 'src/node/services/tools/task_message_sibling.ts'
- 'src/node/services/tools/task_send_message.ts'
- 'src/node/services/workspaceTurnManager.ts'
plan-storage:
- 'formal/plan-storage/**'
- 'src/common/utils/planStorage.ts'
- 'src/node/config/index.ts'
- 'src/node/config/installationIdentity.ts'
- 'src/node/runtime/RemoteRuntime.ts'
- 'src/node/services/agentSession.ts'
- 'src/node/services/utils/fileChangeTracker.ts'
- 'src/node/services/workspaceService.ts'
- 'src/node/utils/runtime/helpers.ts'
- 'src/node/utils/runtime/planLocation.ts'
primitives:
- 'formal/primitives/**'
- 'src/node/services/workflows/keyedFifoLock.ts'
- 'src/node/utils/concurrency/**'
- 'src/node/utils/main/crossProcessLock.ts'
process-liveness:
- 'formal/process-liveness/**'
- 'src/node/utils/concurrency/fileLock.ts'
- 'src/node/utils/concurrency/processLiveness.ts'
- 'src/node/utils/main/crossProcessLock.ts'
ssh-pool:
- 'formal/ssh-pool/**'
- 'src/constants/runtimeReads.ts'
- 'src/node/runtime/RemoteRuntime.ts'
- 'src/node/runtime/Runtime.ts'
- 'src/node/runtime/SSH2ConnectionPool.ts'
- 'src/node/runtime/SSHRuntime.ts'
- 'src/node/runtime/execFileIO.ts'
- 'src/node/runtime/sshBackoff.ts'
- 'src/node/runtime/sshConnectionPool.ts'
- 'src/node/runtime/transports/**'
stream-retry:
- 'formal/stream-retry/**'
- 'src/browser/features/Messages/ChatBarrier/RetryBarrier.tsx'
- 'src/browser/features/Messages/ChatBarrier/StreamingBarrier.tsx'
- 'src/browser/hooks/useAIViewKeybinds.ts'
- 'src/browser/utils/commands/sources.ts'
- 'src/browser/utils/compaction/handler.ts'
- 'src/browser/utils/stopStream.ts'
- 'src/common/orpc/schemas/api.ts'
- 'src/common/utils/messages/retryEligibility.ts'
- 'src/node/services/agentSession.ts'
- 'src/node/services/aiService.ts'
- 'src/node/services/retryManager.ts'
- 'src/node/services/streamManager.ts'
- 'src/node/services/turnCoordinator.ts'
- 'src/node/services/workspaceService.ts'
- 'vscode/src/webview/App.tsx'
task-launch:
- 'formal/task-launch/**'
- 'src/node/runtime/runtimeFactory.ts'
- 'src/node/services/agentSession.ts'
- 'src/node/services/sendIds.ts'
- 'src/node/services/taskService.ts'
- 'src/node/services/utils/forkOrchestrator.ts'
- 'src/node/services/workspaceService.ts'
- 'src/node/services/workspaceUseLeases.ts'
task-lifecycle:
- 'formal/task-lifecycle/**'
- 'src/node/services/taskService.ts'
- 'src/node/services/workspaceService.ts'
- 'src/node/services/workspaceTurnManager.ts'
workflow-runs:
- 'formal/workflow-runs/**'
- 'src/common/utils/workflowRetryEligibility.ts'
- 'src/node/services/taskService.ts'
- 'src/node/services/workflows/**'
workspace-goals:
- 'formal/workspace-goals/**'
- 'src/node/services/agentSession.ts'
- 'src/node/services/goalContinuationPolicy.ts'
- 'src/node/services/heartbeatService.ts'
- 'src/node/services/idleDispatcher.ts'
- 'src/node/services/messageQueue.ts'
- 'src/node/services/workspaceGoalService.ts'
- 'src/node/services/workspaceService.ts'
workspace-leases:
- 'formal/workspace-leases/**'
- 'src/node/runtime/runtimeFactory.ts'
- 'src/node/services/agentSession.ts'
- 'src/node/services/initStateManager.ts'
- 'src/node/services/taskService.ts'
- 'src/node/services/turnRequestBuilder.ts'
- 'src/node/services/workspaceService.ts'
- 'src/node/services/workspaceUseLeases.ts'
- 'src/node/worktree/WorktreeManager.ts'
workspace-lifecycle:
- 'formal/workspace-lifecycle/**'
- 'src/node/services/agentSession.ts'
- 'src/node/services/initStateManager.ts'
- 'src/node/services/taskService.ts'
- 'src/node/services/workspaceService.ts'
- 'src/node/worktree/WorktreeManager.ts'
- name: Select models
id: models
env:
EVENT: ${{ github.event_name }}
CHANGES: ${{ steps.filter.outputs.changes }}
run: |
set -euo pipefail
# Every formal/ subdirectory is a model; a new one without a filter still runs on
# schedule and dispatch, and on PRs that touch this workflow.
all=$(find formal -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort | jq -R . | jq -cs .)
if [[ $EVENT != pull_request ]] || jq -e 'index("workflow")' <<<"$CHANGES" >/dev/null; then
models=$all
else
models=$(jq -c --argjson all "$all" '[.[] | select(. as $m | $all | index($m))]' <<<"$CHANGES")
fi
echo "models=$models" >>"$GITHUB_OUTPUT"
echo "models: $models"
check:
name: ${{ matrix.model }}
needs: plan
if: needs.plan.outputs.models != '[]'
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
# Full runs include configs that take ~30 min each; PR runs skip those.
timeout-minutes: ${{ github.event_name == 'pull_request' && 45 || 300 }}
strategy:
fail-fast: false
matrix:
model: ${{ fromJSON(needs.plan.outputs.models) }}
env:
MODEL: ${{ matrix.model }}
# PR runs skip the slow configs (see each check.sh); schedule and dispatch run them all.
FORMAL_FAST: ${{ github.event_name == 'pull_request' && '1' || '0' }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- name: Detect tool
id: tool
run: |
set -euo pipefail
if [[ -f formal/$MODEL/lean-toolchain ]]; then echo "kind=lean"; else echo "kind=tla"; fi >>"$GITHUB_OUTPUT"
# --- TLA+ (TLC) ---
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
if: steps.tool.outputs.kind == 'tla'
with:
distribution: temurin
java-version: "21"
- name: Cache tla2tools.jar
id: tlc-cache
if: steps.tool.outputs.kind == 'tla'
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.cache/formal/tla2tools.jar
key: tla2tools-${{ env.TLAPLUS_COMMIT }}-${{ env.TLAPLUS_SRC_SHA256 }}-ant${{ env.ANT_VERSION }}
- name: Build tla2tools.jar
if: steps.tool.outputs.kind == 'tla' && steps.tlc-cache.outputs.cache-hit != 'true'
run: |
set -euo pipefail
work=$RUNNER_TEMP/tla-build
mkdir -p "$work" ~/.cache/formal
cd "$work"
curl -fsSL --retry 3 -o ant.tar.gz \
"https://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VERSION-bin.tar.gz"
echo "$ANT_SHA512 ant.tar.gz" | sha512sum -c -
tar xzf ant.tar.gz
curl -fsSL --retry 3 -o tlaplus.tar.gz \
"https://github.com/tlaplus/tlaplus/archive/$TLAPLUS_COMMIT.tar.gz"
echo "$TLAPLUS_SRC_SHA256 tlaplus.tar.gz" | sha256sum -c -
tar xzf tlaplus.tar.gz
cd "tlaplus-$TLAPLUS_COMMIT/tlatools/org.lamport.tlatools"
# The archive has no .git, so pass the revision instead of the jgit `info` target;
# `dist` also packages a few test helpers, which TLC does not need.
mkdir -p test-class
"$work/apache-ant-$ANT_VERSION/bin/ant" -q -f customBuild.xml compile dist \
-Dgit.revision="$TLAPLUS_COMMIT" -Dgit.shortRevision="${TLAPLUS_COMMIT:0:7}" \
-Dgit.branch=master -Dgit.tag= -Dgit.commitsCount=0
cp dist/tla2tools.jar ~/.cache/formal/tla2tools.jar
- name: Install tlc wrapper
if: steps.tool.outputs.kind == 'tla'
run: |
set -euo pipefail
wrapper=$RUNNER_TEMP/bin/tlc
mkdir -p "$(dirname "$wrapper")"
cat >"$wrapper" <<'EOF'
#!/usr/bin/env bash
exec java -XX:+UseParallelGC ${TLA_JAVA_OPTS:-} -cp "$HOME/.cache/formal/tla2tools.jar" tlc2.TLC "$@"
EOF
chmod +x "$wrapper"
echo "TLC=$wrapper" >>"$GITHUB_ENV"
unzip -p ~/.cache/formal/tla2tools.jar META-INF/MANIFEST.MF | grep X-Git-Revision
# --- Lean (lake) ---
- name: Cache elan and the Lean toolchain
id: elan-cache
if: steps.tool.outputs.kind == 'lean'
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.elan
key: elan-${{ env.ELAN_VERSION }}-${{ hashFiles('formal/*/lean-toolchain') }}
- name: Install elan
if: steps.tool.outputs.kind == 'lean' && steps.elan-cache.outputs.cache-hit != 'true'
run: |
set -euo pipefail
cd "$RUNNER_TEMP"
curl -fsSL --retry 3 -o elan.tar.gz \
"https://github.com/leanprover/elan/releases/download/v$ELAN_VERSION/elan-x86_64-unknown-linux-gnu.tar.gz"
echo "$ELAN_SHA256 elan.tar.gz" | sha256sum -c -
tar xzf elan.tar.gz
./elan-init -y --no-modify-path --default-toolchain none
- name: Point check.sh at lake
if: steps.tool.outputs.kind == 'lean'
run: |
set -euo pipefail
{ echo "LAKE=$HOME/.elan/bin/lake"; echo "LEANCHECKER=$HOME/.elan/bin/leanchecker"; } >>"$GITHUB_ENV"
- name: Run formal/${{ matrix.model }}/check.sh
env:
# Scripts write their TLC logs under OUT or TMPDIR; both land in the uploaded dir.
TMPDIR: ${{ runner.temp }}/formal-tmp
OUT: ${{ runner.temp }}/formal-tmp/out
run: |
set -euo pipefail
mkdir -p "$TMPDIR" "$OUT"
args=()
if [[ $FORMAL_FAST != 1 ]]; then
# Opt-in deep configs that each check.sh leaves out by default.
case $MODEL in
primitives) export DEEP=1 ;;
delegated-turns) for cfg in formal/delegated-turns/MC_*.cfg; do args+=("${cfg##*/}"); done ;;
esac
fi
"formal/$MODEL/check.sh" "${args[@]}"
- name: Upload TLC logs
if: failure()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: formal-${{ matrix.model }}-logs
path: ${{ runner.temp }}/formal-tmp/**/*.log
if-no-files-found: ignore
retention-days: 7