@defrex/autobuild 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/SPEC.md +38 -11
- package/docs/answering-blocked-builds.md +5 -3
- package/docs/architecture.md +12 -0
- package/docs/configuration.md +16 -8
- package/docs/operating.md +8 -0
- package/docs/operator-api.md +1 -1
- package/docs/operator-surfaces.md +1 -1
- package/docs/remote-store-protocol.md +1 -1
- package/docs/troubleshooting.md +16 -1
- package/package.json +3 -3
- package/packages/core/src/cli/dispatch.ts +21 -2
- package/packages/core/src/config/schema.ts +2 -2
- package/packages/core/src/events/policy.ts +1 -0
- package/packages/core/src/events/repository.ts +19 -0
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +4 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/be211f0e31a65006.json.gz +0 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/312cc4090820a612.json +1078 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a2780567b4989fb6.json +105 -0
- package/packages/core/src/kernel/done-escalations.ts +8 -4
- package/packages/core/src/kernel/reducer-revisions.ts +4 -0
- package/packages/core/src/kernel/reducer.ts +15 -1
- package/packages/core/src/kernel/repository-read-facts.ts +9 -0
- package/packages/core/src/ports/workspace/build-execution.ts +9 -1
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +99 -12
- package/packages/core/src/processes/dispatcher.ts +312 -33
- package/packages/core/src/processes/execution-settlement.ts +24 -3
- package/packages/core/src/processes/tick-publication.ts +1 -0
- package/packages/core/src/store/contract.ts +7 -0
- package/packages/core/src/store/reducer-value-shapes.json +5320 -5210
- package/packages/core/src/store/reducer-value-validation.ts +7 -0
- package/packages/core/src/store/remote/released-clients.json +11 -0
- package/packages/core/src/store/remote/released-reducer-values/1.14.0.json +36076 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +18 -16
- package/packages/core/src/store/repo-state-events.ts +1 -0
- package/packages/core/src/testing/dispatch-read-budget.ts +12 -2
- package/packages/core/src/testing/reduced-read-budget.ts +208 -1
- package/skills/guide/SKILL.md +18 -9
- package/skills/guide/references/operator-api.md +1 -1
- package/skills/guide/references/remote-store-protocol.md +1 -1
- package/skills/operate/SKILL.md +55 -5
- package/templates/hosted-service/package.json +2 -2
|
@@ -4,14 +4,15 @@ import release1 from './1.11.0.json'
|
|
|
4
4
|
import release2 from './1.11.1.json'
|
|
5
5
|
import release3 from './1.12.0.json'
|
|
6
6
|
import release4 from './1.13.0.json'
|
|
7
|
-
import release5 from './1.
|
|
8
|
-
import release6 from './1.
|
|
9
|
-
import release7 from './1.
|
|
10
|
-
import release8 from './1.
|
|
11
|
-
import release9 from './1.
|
|
12
|
-
import release10 from './1.
|
|
13
|
-
import release11 from './1.
|
|
14
|
-
import release12 from './1.
|
|
7
|
+
import release5 from './1.14.0.json'
|
|
8
|
+
import release6 from './1.2.0.json'
|
|
9
|
+
import release7 from './1.3.0.json'
|
|
10
|
+
import release8 from './1.4.0.json'
|
|
11
|
+
import release9 from './1.5.0.json'
|
|
12
|
+
import release10 from './1.6.0.json'
|
|
13
|
+
import release11 from './1.7.0.json'
|
|
14
|
+
import release12 from './1.8.0.json'
|
|
15
|
+
import release13 from './1.9.0.json'
|
|
15
16
|
import type { ReducerValueCatalog } from '../../reducer-value-validation'
|
|
16
17
|
export interface ReleasedReducerValues extends ReducerValueCatalog {
|
|
17
18
|
versions: Record<string, number>
|
|
@@ -22,12 +23,13 @@ export const RELEASED_REDUCER_VALUES: Readonly<Record<string, ReleasedReducerVal
|
|
|
22
23
|
'1.11.1.json': release2,
|
|
23
24
|
'1.12.0.json': release3,
|
|
24
25
|
'1.13.0.json': release4,
|
|
25
|
-
'1.
|
|
26
|
-
'1.
|
|
27
|
-
'1.
|
|
28
|
-
'1.
|
|
29
|
-
'1.
|
|
30
|
-
'1.
|
|
31
|
-
'1.
|
|
32
|
-
'1.
|
|
26
|
+
'1.14.0.json': release5,
|
|
27
|
+
'1.2.0.json': release6,
|
|
28
|
+
'1.3.0.json': release7,
|
|
29
|
+
'1.4.0.json': release8,
|
|
30
|
+
'1.5.0.json': release9,
|
|
31
|
+
'1.6.0.json': release10,
|
|
32
|
+
'1.7.0.json': release11,
|
|
33
|
+
'1.8.0.json': release12,
|
|
34
|
+
'1.9.0.json': release13,
|
|
33
35
|
}
|
|
@@ -66,6 +66,7 @@ export const REPOSITORY_STATE_EVENT_TYPES: readonly RepositoryEventType[] = [
|
|
|
66
66
|
export const REPOSITORY_LATEST_EVENT_TYPES: readonly RepositoryEventType[] = [
|
|
67
67
|
'dispatcher.ticket-scan-completed',
|
|
68
68
|
'dispatcher.placement-set',
|
|
69
|
+
'dispatcher.work-deferred',
|
|
69
70
|
]
|
|
70
71
|
const LATEST_TYPES = new Set<string>(REPOSITORY_LATEST_EVENT_TYPES)
|
|
71
72
|
|
|
@@ -1008,8 +1008,15 @@ async function webOverviewReadBudget(store: BuildStore, backing: BuildStore): Pr
|
|
|
1008
1008
|
for (let i = 0; i < n - 5; i++) {
|
|
1009
1009
|
const slug = `${prefix}done-${String(i).padStart(6, '0')}`
|
|
1010
1010
|
await create(slug)
|
|
1011
|
-
// Every fourth build aborts, then finishes its cleanup.
|
|
1011
|
+
// Every fourth build aborts, then finishes its cleanup. The first was
|
|
1012
|
+
// blocked when aborted: the abort closed its escalation (#1387).
|
|
1012
1013
|
if (i % 4 === 3) {
|
|
1014
|
+
if (i === 3)
|
|
1015
|
+
await backing.append(slug, {
|
|
1016
|
+
actor: KERNEL,
|
|
1017
|
+
type: 'escalation.raised',
|
|
1018
|
+
payload: { id: 'abort-closed', phase: 'implement', source: 'agent', question: 'q' },
|
|
1019
|
+
})
|
|
1013
1020
|
await backing.append(slug, { actor: KERNEL, type: 'build.aborted', payload: {} })
|
|
1014
1021
|
await complete(slug, 'abandoned')
|
|
1015
1022
|
} else await complete(slug)
|
|
@@ -1098,10 +1105,13 @@ async function webOverviewReadBudget(store: BuildStore, backing: BuildStore): Pr
|
|
|
1098
1105
|
Object.keys(buildScope(calls)).every((name) => name.endsWith(`:${slug.replace(prefix, '')}`))
|
|
1099
1106
|
|
|
1100
1107
|
// (a) The first read: both rollups, the five live builds and the
|
|
1101
|
-
// escalated done build.
|
|
1108
|
+
// escalated done build, never the build whose abort closed its question.
|
|
1102
1109
|
const first = await measure('first')
|
|
1103
1110
|
expect(first.calls['getReducerValue:rollup']).toBe(2)
|
|
1104
1111
|
expect(buildScope(first.calls)).toEqual(reads(...[0, 1, 2, 3, 4].map(live), escalated))
|
|
1112
|
+
expect(
|
|
1113
|
+
[...frame.overview!.active, ...frame.overview!.queued].map((row) => row.slug),
|
|
1114
|
+
).not.toContain(`${prefix}done-000003`)
|
|
1105
1115
|
expect(first.rows).toBe(0)
|
|
1106
1116
|
expect(first.repoRows).toBe(0)
|
|
1107
1117
|
expect(frame.overview!.active.length + frame.overview!.queued.length).toBe(6)
|
|
@@ -2517,6 +2517,191 @@ export async function flaggedWorkspaceSweepReadBudget(opts: {
|
|
|
2517
2517
|
})
|
|
2518
2518
|
}
|
|
2519
2519
|
|
|
2520
|
+
/** #1406: the early stage that serves `dispatcher.work-deferred` first. It
|
|
2521
|
+
* runs on every tick, so with no carried entry it makes no store request at
|
|
2522
|
+
* all, and with one it reads only the carried builds: the same reads at 100
|
|
2523
|
+
* and 100,000 events, whatever number of unrelated builds (here ones a newer
|
|
2524
|
+
* writer's decisive fact defers) the repository holds. Each carried build is
|
|
2525
|
+
* swept once per tick, so carrying it adds no reads to the tick. A carried
|
|
2526
|
+
* build its own mixed-version check defers stays carried. Fresh dispatchers
|
|
2527
|
+
* per tick: no per-process cache. */
|
|
2528
|
+
export async function deferredWorkReadBudget(): Promise<void> {
|
|
2529
|
+
const { newerFact, seedNewerMemoryFact } = await import('./newer-writer')
|
|
2530
|
+
const { MemoryBuildStore } = await import('../store/memory')
|
|
2531
|
+
const repo = '/repos/deferred-work'
|
|
2532
|
+
const sha = 'a'.repeat(40)
|
|
2533
|
+
const config = parseConfig('[tickets]\nsource = "file"\nreadyState = "Ready"\n')
|
|
2534
|
+
async function world(length: number, unrelated: number) {
|
|
2535
|
+
let now = Date.parse('2026-12-01T00:00:00.000Z')
|
|
2536
|
+
const clock = () => new Date(now)
|
|
2537
|
+
const store = new MemoryBuildStore({ clock })
|
|
2538
|
+
await store.ensureRepo(repo)
|
|
2539
|
+
const created = (slug: string) => ({
|
|
2540
|
+
slug,
|
|
2541
|
+
repo,
|
|
2542
|
+
ticket: { source: 'fake', id: `T-${slug}` },
|
|
2543
|
+
branch: slug,
|
|
2544
|
+
created: {
|
|
2545
|
+
actor: DISPATCHER,
|
|
2546
|
+
type: 'build.created' as const,
|
|
2547
|
+
payload: { ticket: { source: 'fake', id: `T-${slug}` }, repo, baseBranch: 'main' },
|
|
2548
|
+
},
|
|
2549
|
+
})
|
|
2550
|
+
for (let i = 1; i <= unrelated; i++) {
|
|
2551
|
+
await store.createBuild(created(`deferred-${i}`))
|
|
2552
|
+
seedNewerMemoryFact(store, newerFact(2, 'decisive', `deferred-${i}`))
|
|
2553
|
+
}
|
|
2554
|
+
// The carried leaf: its execution ended on a sandbox that has since
|
|
2555
|
+
// stopped, and it holds its slot.
|
|
2556
|
+
const slug = 'carried'
|
|
2557
|
+
await store.createBuild(created(slug))
|
|
2558
|
+
await seedBuildFiller(store, slug, length, INERT_BUILD_FILLER)
|
|
2559
|
+
const ticket = { source: 'fake', id: `T-${slug}`, title: slug }
|
|
2560
|
+
for (const event of [
|
|
2561
|
+
{
|
|
2562
|
+
type: 'workspace.provisioned',
|
|
2563
|
+
payload: {
|
|
2564
|
+
provider: 'remote-test',
|
|
2565
|
+
ref: 'carried-g0',
|
|
2566
|
+
path: '/remote/workspace',
|
|
2567
|
+
branch: slug,
|
|
2568
|
+
base: { source: 'existing', sha },
|
|
2569
|
+
},
|
|
2570
|
+
},
|
|
2571
|
+
{ type: 'spec.imported', payload: { artifact: { kind: 'spec', rev: 0 }, ticket } },
|
|
2572
|
+
{ type: 'target.moved', payload: { branch: 'main', sha } },
|
|
2573
|
+
{ type: 'slot.admitted', payload: {} },
|
|
2574
|
+
{
|
|
2575
|
+
type: 'execution.started',
|
|
2576
|
+
payload: { provider: 'remote-test', workspaceRef: 'carried-g0', instance: 'i-1' },
|
|
2577
|
+
},
|
|
2578
|
+
{
|
|
2579
|
+
type: 'execution.ended',
|
|
2580
|
+
payload: { instance: 'i-1', workspaceRef: 'carried-g0', outcome: 'completed', exitCode: 0 },
|
|
2581
|
+
},
|
|
2582
|
+
])
|
|
2583
|
+
await store.append(slug, { actor: DISPATCHER, ...event } as never)
|
|
2584
|
+
await store.append(slug, { actor: KERNEL, type: 'plan.started', payload: { round: 1 } })
|
|
2585
|
+
now += 3_600_000
|
|
2586
|
+
const launches: string[] = []
|
|
2587
|
+
const dispatcher = () =>
|
|
2588
|
+
new Dispatcher({
|
|
2589
|
+
store,
|
|
2590
|
+
tickets: new FakeTicketSource([]),
|
|
2591
|
+
workspaces: {
|
|
2592
|
+
name: 'remote-test',
|
|
2593
|
+
preservation: async () => ({ outcome: 'preserved', heads: [] }),
|
|
2594
|
+
recovery: {
|
|
2595
|
+
fence: async () => ({ outcome: 'confirmed' }),
|
|
2596
|
+
reap: async () => ({
|
|
2597
|
+
outcome: 'confirmed',
|
|
2598
|
+
snapshots: { outcome: 'confirmed', deleted: 0 },
|
|
2599
|
+
}),
|
|
2600
|
+
},
|
|
2601
|
+
provision: async () => {
|
|
2602
|
+
throw new Error('not used')
|
|
2603
|
+
},
|
|
2604
|
+
release: async () => {},
|
|
2605
|
+
},
|
|
2606
|
+
forge: (() => {
|
|
2607
|
+
const forge = new FakeForge()
|
|
2608
|
+
forge.seedBranch('main', sha)
|
|
2609
|
+
return forge
|
|
2610
|
+
})(),
|
|
2611
|
+
config,
|
|
2612
|
+
repo,
|
|
2613
|
+
exec: async () => ({ stdout: `${sha}\trefs/heads/main\n`, stderr: '', exitCode: 0 }),
|
|
2614
|
+
launchRunner: async (launched: string) => {
|
|
2615
|
+
launches.push(launched)
|
|
2616
|
+
return 'scheduled' as const
|
|
2617
|
+
},
|
|
2618
|
+
ids: sequentialIds(),
|
|
2619
|
+
clock,
|
|
2620
|
+
})
|
|
2621
|
+
// One canonical reduction per key happens before anything is measured.
|
|
2622
|
+
await readRepositoryFacts(store, repo)
|
|
2623
|
+
await readBuildDigests(store, repo)
|
|
2624
|
+
await readBuildFacts(store, slug)
|
|
2625
|
+
for (let i = 1; i <= unrelated; i++) await readBuildFacts(store, `deferred-${i}`)
|
|
2626
|
+
const carry = (builds: { slug: string; step: 'resume' }[]) =>
|
|
2627
|
+
store.appendRepo(repo, {
|
|
2628
|
+
actor: DISPATCHER,
|
|
2629
|
+
type: 'dispatcher.work-deferred',
|
|
2630
|
+
payload: { builds },
|
|
2631
|
+
})
|
|
2632
|
+
/** One tick on a fresh dispatcher: the early stage's own store traffic
|
|
2633
|
+
* and the whole tick's requests naming the carried build. */
|
|
2634
|
+
const tick = async () => {
|
|
2635
|
+
const ticking = dispatcher()
|
|
2636
|
+
const stage = Reflect.get(ticking, 'serviceDeferredWork') as (
|
|
2637
|
+
...args: unknown[]
|
|
2638
|
+
) => Promise<void>
|
|
2639
|
+
let early: StoreReadMetrics | undefined
|
|
2640
|
+
Reflect.set(ticking, 'serviceDeferredWork', async (...args: unknown[]) => {
|
|
2641
|
+
early = await measureStoreReads(store, () => stage.apply(ticking, args))
|
|
2642
|
+
})
|
|
2643
|
+
const whole = await measureStoreReads(store, async () => {
|
|
2644
|
+
await ticking.tick({ acceptNewWork: false })
|
|
2645
|
+
})
|
|
2646
|
+
return { early: early!, carriedCalls: whole.slugs[slug] ?? 0 }
|
|
2647
|
+
}
|
|
2648
|
+
return { store, slug, launches, carry, tick }
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
const stages: Record<
|
|
2652
|
+
string,
|
|
2653
|
+
{ calls: Record<string, number>; slugs: Record<string, number>; rows: number }
|
|
2654
|
+
> = {}
|
|
2655
|
+
for (const length of [100, 100_000]) {
|
|
2656
|
+
for (const unrelated of [20, 200]) {
|
|
2657
|
+
const w = await world(length, unrelated)
|
|
2658
|
+
// No carried entry: the stage makes no store request at all.
|
|
2659
|
+
await w.carry([])
|
|
2660
|
+
const idle = await w.tick()
|
|
2661
|
+
expect(idle.early.calls).toEqual({})
|
|
2662
|
+
expect(w.launches).toEqual([w.slug]) // the lease sweep launched it
|
|
2663
|
+
// Carried, with one carried build its mixed-version check defers.
|
|
2664
|
+
w.launches.length = 0
|
|
2665
|
+
await w.carry([
|
|
2666
|
+
{ slug: w.slug, step: 'resume' },
|
|
2667
|
+
{ slug: 'deferred-1', step: 'resume' },
|
|
2668
|
+
])
|
|
2669
|
+
const { early } = await w.tick()
|
|
2670
|
+
expect(w.launches).toEqual([w.slug])
|
|
2671
|
+
expect(Object.keys(early.slugs).sort()).toEqual([w.slug, 'deferred-1'].sort())
|
|
2672
|
+
// Only the tail the previous tick appended, never the seeded history.
|
|
2673
|
+
expect(early.read.every((row) => row.slug !== w.slug || row.seq > length)).toBe(true)
|
|
2674
|
+
const latest = (await w.store.getRepoEvents(repo)).findLast(
|
|
2675
|
+
(event) => event.type === 'dispatcher.work-deferred',
|
|
2676
|
+
)
|
|
2677
|
+
expect(latest?.payload).toEqual({ builds: [{ slug: 'deferred-1', step: 'resume' }] })
|
|
2678
|
+
stages[`${length}:${unrelated}`] = {
|
|
2679
|
+
calls: early.calls,
|
|
2680
|
+
slugs: early.slugs,
|
|
2681
|
+
rows: early.rows,
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
const [first, ...rest] = Object.values(stages)
|
|
2686
|
+
for (const other of rest) expect(other).toEqual(first!)
|
|
2687
|
+
|
|
2688
|
+
// Carrying a build adds no reads of it to the tick: the early stage's
|
|
2689
|
+
// sweep replaces the lease sweep's (and the settlement stage skips it).
|
|
2690
|
+
const carried = await world(100, 0)
|
|
2691
|
+
await carried.carry([{ slug: carried.slug, step: 'resume' }])
|
|
2692
|
+
const swept = await world(100, 0)
|
|
2693
|
+
const withHint = (await carried.tick()).carriedCalls
|
|
2694
|
+
const withoutHint = (await swept.tick()).carriedCalls
|
|
2695
|
+
expect(carried.launches).toEqual(swept.launches)
|
|
2696
|
+
expect(withHint).toBeLessThanOrEqual(withoutHint)
|
|
2697
|
+
console.log('deferred work read budget', {
|
|
2698
|
+
histories: [100, 100_000],
|
|
2699
|
+
unrelated: [20, 200],
|
|
2700
|
+
earlyStageCalls: first!.calls,
|
|
2701
|
+
carriedCallsPerTick: { withHint, withoutHint },
|
|
2702
|
+
})
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2520
2705
|
/** A provision continuation that reaches its launch for a build at the
|
|
2521
2706
|
* no-progress limit applies the guard instead of starting a runner. Each
|
|
2522
2707
|
* continuation is a recurring invocation (every re-provision, every remote
|
|
@@ -8717,6 +8902,28 @@ export async function openBuildListingReadBudget(opts: { commands?: boolean } =
|
|
|
8717
8902
|
type: 'escalation.answered',
|
|
8718
8903
|
payload: { id: 'integration-audit-op', answer: 'ack', resolution: 'retry' },
|
|
8719
8904
|
})
|
|
8905
|
+
// Aborted while blocked: the abort closed its escalation (#1387), so it
|
|
8906
|
+
// is listed nowhere and adds no read.
|
|
8907
|
+
await store.createBuild({
|
|
8908
|
+
slug: 'done-abort-closed',
|
|
8909
|
+
repo,
|
|
8910
|
+
created: created('done-abort-closed'),
|
|
8911
|
+
})
|
|
8912
|
+
await store.append('done-abort-closed', {
|
|
8913
|
+
actor: KERNEL,
|
|
8914
|
+
type: 'escalation.raised',
|
|
8915
|
+
payload: { id: 'abort-closed', phase: 'implement', source: 'agent', question: 'q' },
|
|
8916
|
+
})
|
|
8917
|
+
await store.append('done-abort-closed', {
|
|
8918
|
+
actor: DISPATCHER,
|
|
8919
|
+
type: 'build.aborted',
|
|
8920
|
+
payload: {},
|
|
8921
|
+
})
|
|
8922
|
+
await store.append('done-abort-closed', {
|
|
8923
|
+
actor: DISPATCHER,
|
|
8924
|
+
type: 'build.completed',
|
|
8925
|
+
payload: { outcome: 'abandoned' },
|
|
8926
|
+
})
|
|
8720
8927
|
for (let i = 0; i < settled; i++) {
|
|
8721
8928
|
const slug = `settled-${i}`
|
|
8722
8929
|
await store.createBuild({ slug, repo, created: created(slug) })
|
|
@@ -8837,7 +9044,7 @@ export async function openBuildListingReadBudget(opts: { commands?: boolean } =
|
|
|
8837
9044
|
expect(digest.escalations.map(({ slug, status }) => ({ slug, status }))).toEqual([
|
|
8838
9045
|
{ slug: 'done-escalated', status: 'done' },
|
|
8839
9046
|
])
|
|
8840
|
-
expect(JSON.stringify(digest)).not.toMatch(/open-aborted|settled-/)
|
|
9047
|
+
expect(JSON.stringify(digest)).not.toMatch(/open-aborted|done-abort-closed|settled-/)
|
|
8841
9048
|
const rows = memoryRepositoryReadCounter(store, repo)
|
|
8842
9049
|
const entries = memoryListingEntryCounter(store)
|
|
8843
9050
|
const calls = memoryStoreRequestCounter(store)
|
package/skills/guide/SKILL.md
CHANGED
|
@@ -893,10 +893,11 @@ publishes the exact SHA/branch through a temporary narrow firewall transform,
|
|
|
893
893
|
verifies it, and performs PR work locally. Ordinary completion deletes the VM.
|
|
894
894
|
The guest runner records its exit on the sandbox filesystem, so a session that
|
|
895
895
|
finished before its VM stopped still settles and publishes: recovery resumes a
|
|
896
|
-
stopped sandbox explicitly
|
|
897
|
-
resume plus guest git and push)
|
|
898
|
-
|
|
899
|
-
|
|
896
|
+
stopped sandbox explicitly, with `recoveryTimeoutMs` (default 120000, the cold
|
|
897
|
+
resume plus guest git and push) as its ceiling. A hosted invocation starts it
|
|
898
|
+
only while a realistic resume (about 45 s) plus the cleanup reserve fits, never
|
|
899
|
+
runs it past the deadline, and never stops a sandbox the provider already
|
|
900
|
+
reports stopped. `operationTimeoutMs` bounds each metadata acknowledgement.
|
|
900
901
|
Branch config, installed skills, relative/package plugins, setup, and phase CLI
|
|
901
902
|
commands resolve from the guest checkout, never dispatcher paths.
|
|
902
903
|
|
|
@@ -1262,8 +1263,13 @@ replacement consumes no infrastructure attempt. A preservation or release
|
|
|
1262
1263
|
failure is recorded against its build, as an infrastructure failure or janitor
|
|
1263
1264
|
attention, and never stops the dispatcher from advancing other builds. The
|
|
1264
1265
|
recorded error and the infrastructure-limit escalation name the failed recovery
|
|
1265
|
-
step: `resume`, `fence`, `preserve` or `cleanup`. Work
|
|
1266
|
-
|
|
1266
|
+
step: `resume`, `fence`, `preserve` or `cleanup`. Work a hosted invocation's
|
|
1267
|
+
deadline cuts short or cannot fit charges no infrastructure attempt: a resume it
|
|
1268
|
+
cut short is stopped or left uncertain for a later fence. The tick counts the
|
|
1269
|
+
build as `recoveryDeferred` (or `provisioningDeferred` for a provision that
|
|
1270
|
+
needs about 150 s), logs `build <slug>: <step> deferred by the invocation
|
|
1271
|
+
budget`, never reports idle, and records it in `dispatcher.work-deferred`, so
|
|
1272
|
+
the next invocation runs that build first.
|
|
1267
1273
|
Fencing is revalidated after restart; a saved receipt alone never authorizes
|
|
1268
1274
|
cleanup of a newer execution. Current recovery notes are linked by the session
|
|
1269
1275
|
manifest's `workspaceRecovery` field. Recovery notes apply to the next session
|
|
@@ -2864,8 +2870,8 @@ suppressed; `--plain` and non-TTY output remain line-oriented and unchanged. A
|
|
|
2864
2870
|
satisfied verify skip carries the literal `skipped` qualifier, so it remains
|
|
2865
2871
|
distinct from a pass without color. Every nonterminal build has a row,
|
|
2866
2872
|
including `queued` builds that have not attached a runner. A done build with an
|
|
2867
|
-
open escalation (a post-landing integration audit, or
|
|
2868
|
-
|
|
2873
|
+
open escalation (a post-landing integration audit, or an escalation raised
|
|
2874
|
+
during abort cleanup) also has a row, red `BLOCKED` with the note
|
|
2869
2875
|
`done` and its question, holding no slot, until `ab answer` acknowledges it. A newly claimed
|
|
2870
2876
|
build holds its slot from the claim, so its row shows its ticket, slug, green
|
|
2871
2877
|
`STARTING` status, and either the pending dispatch boundary or the latest
|
|
@@ -3125,7 +3131,10 @@ and exit, then reaps remaining descendants with bounded TERM-then-KILL cleanup.
|
|
|
3125
3131
|
Only then does it release the lease. Graceful dispatcher shutdown likewise waits
|
|
3126
3132
|
for runner suspension without a wall-clock force-exit deadline. A queued, paused
|
|
3127
3133
|
or blocked build with no live execution is acknowledged by the dispatcher
|
|
3128
|
-
directly, without provisioning a workspace or starting a runner.
|
|
3134
|
+
directly, without provisioning a workspace or starting a runner. Acknowledging
|
|
3135
|
+
the abort (`build.aborted`) closes every escalation then open, unanswered, so
|
|
3136
|
+
nothing needs acknowledging afterwards unless cleanup or a later audit raises a
|
|
3137
|
+
new one.
|
|
3129
3138
|
The dispatcher defers cleanup while that lease is live, then performs the
|
|
3130
3139
|
checkpointed, retry-safe cleanup: close an open unmerged PR, release the workspace,
|
|
3131
3140
|
delete the exact remote and local build branches, preserve existing ticket labels
|
|
@@ -85,7 +85,7 @@ raw session-event append. External operator harnesses own agent execution.
|
|
|
85
85
|
| Method and path | Result |
|
|
86
86
|
|---|---|
|
|
87
87
|
| `GET …/builds?scope=active\|queued\|all` | Build summaries, newest update first. `queued` means active plus queued, matching `ab builds --queued`. Each nonterminal summary's `slot` is `{state: "held"}`, `{state: "requested", request, priority?: "urgent" \| "high" \| "low"}` or `{state: "none"}`; absent means unknown (an older server), never `none`. Its `statusWord` is `{word, tone, note?}`, the status word every surface shows; `status` stays the reducer's lifecycle status. |
|
|
88
|
-
| `GET …/builds/{slug}` | `{detail, dashboardRow}`; `detail.slot` and `dashboardRow.slot` carry the build's slot state, shaped as in `GET …/builds`; `detail.runnerAttaches` records chronological attach boundaries and their runtime identity (version, commit, source kind/location), with null runtime for unrecorded historical attaches; `dashboardRow` remains a `CLEANING` row after `build.aborted` and becomes `null` only when the dashboard stops listing it: at `build.completed` when no escalation is open. A completed build with an open escalation keeps, or regains, a `BLOCKED` row (note `done`), including
|
|
88
|
+
| `GET …/builds/{slug}` | `{detail, dashboardRow}`; `detail.slot` and `dashboardRow.slot` carry the build's slot state, shaped as in `GET …/builds`; `detail.runnerAttaches` records chronological attach boundaries and their runtime identity (version, commit, source kind/location), with null runtime for unrecorded historical attaches; `dashboardRow` remains a `CLEANING` row after `build.aborted` and becomes `null` only when the dashboard stops listing it: at `build.completed` when no escalation is open. A completed build with an open escalation keeps, or regains, a `BLOCKED` row (note `done`), including one raised during abort cleanup; abort itself closes the escalations open when it is accepted. The row becomes `null` once the escalation is acknowledged; neither step reopens its lifecycle state. |
|
|
89
89
|
| `GET …/dashboard` | `{generatedAt, model, settingsHeader}`. `model` is the dashboard's rows, steps, elapsed timing inputs, harvest row, triage (when the dispatcher published one)/queue/capacity and settings projection. `model.capacity.slots` maps each build to its slot state, and each `model.builds[].slot` repeats it; absent means unknown. `model.configuration` is `"no-dispatcher-run"` when the repository records no dispatcher run, and absent otherwise. Optional `rollback` contains `correlation`, `lineage`, full `failed` and `restored` runtime identities and rollback event `ts` for the authoritative dispatcher lineage’s unresolved hold. Both dashboards name failed, restored and held runtime plus timestamp. Matching durable different-target hold clearance removes it; a fresh operator lineage hides it only after a committed operational tick or accepted takeover. Run-started and yielded ticks alone cannot replace authority; same-lineage generations retain the notice. Historical rollback records are not fallback notices. Optional `handoffs` lists all accepted unfinished handoffs with predecessor `run`, optional `successor`, `correlation`, full `from`/`to` runtimes, `mode` and optional `deadline`. Outstanding drain-mode builds carry `draining: true`, also on build-detail `dashboardRow`; matching settlement removes it. Accepted completion removes the handoff; neither takeover nor the clock does. Missing historical mode means cutover and missing deadline displays unknown. |
|
|
90
90
|
| `GET …/status` | Repository intake, pause, and default-auto-merge projection, plus `ticketStarts` (`{pending, recent}`, each entry with its `priority`) when single-ticket start requests are pending or recently settled. `capacity.slots`, when the held configuration is readable, maps each nonterminal build to its slot state; `capacity.occupied` counts its `held` entries. Its `operator` is `{presence: "unavailable", reason}`: this route does not load presence registrations, so it is not evidence that no operator is present. |
|
|
91
91
|
| `GET …/harvest/status` | Harvest gate, runs, steps, recovery, and attention projection. |
|
|
@@ -776,7 +776,7 @@ builds.
|
|
|
776
776
|
| `appendRepo` | `POST /repos/{repo}/events` | event write | `201` + repository event envelope |
|
|
777
777
|
| `appendRepoIfCurrent` | `POST /repos/{repo}/events/conditional` | `{"expectedSeq": nonnegative integer, "event": event write}` | appended: `201` + repository event envelope; journal advanced: `200 null` (mirroring section 3's build compare-and-append). A server without the route answers `404`; callers report it and never fall back to an unconditional append |
|
|
778
778
|
| `getRepoEvents` / `getRepositoryTail` | `GET /repos/{repo}/events?since={n}&through={n}&wait={s}` | optional `since` query value, parsed as in section 3; absence defaults to `0`. Optional `wait` in whole seconds, per the event-wait rules of section 3 | `200` + envelopes with `seq > since`, up to the frozen head; optional `through` caps the response at `seq <= through`; `409 cursor-too-old` below `max(0, head - 1000)` |
|
|
779
|
-
| `getRepoStateEvents` | `GET /repos/{repo}/state-events` | none | `200` + the bounded repository-journal subset (AUT-489): every durable event type (`ticket-preparation.*`, `harvest.*`, `orchestrator.sandbox.*`, the three dispatcher setting types, and cross-generation handoff correlation facts: target-prepared, yield-requested, upgrade-failed, handoff-started, terminal-released, takeover, drain-deadline, drain-settled and handoff-completed) plus the latest-only `dispatcher.ticket-scan-completed` and `dispatcher.
|
|
779
|
+
| `getRepoStateEvents` | `GET /repos/{repo}/state-events` | none | `200` + the bounded repository-journal subset (AUT-489): every durable event type (`ticket-preparation.*`, `harvest.*`, `orchestrator.sandbox.*`, the three dispatcher setting types, and cross-generation handoff correlation facts: target-prepared, yield-requested, upgrade-failed, handoff-started, terminal-released, takeover, drain-deadline, drain-settled and handoff-completed) plus the latest-only `dispatcher.ticket-scan-completed`, `dispatcher.placement-set` and `dispatcher.work-deferred` facts and, when the journal has one, the tail from the latest `dispatcher.run-started`, in increasing sequence order; served inside the repository-existence gate like `GET events`, so an unknown repository is `404` |
|
|
780
780
|
| `getReducerSnapshot` (repo scope) | `GET /repos/{repo}/snapshots/{reducer}?version={n}` | required `version` query value, a positive integer; `reducer` is a registry name (`^[A-Za-z][A-Za-z0-9._-]{0,63}$`) | `200` + `{"version", "cursor", "state"}` or `200 null` when absent, written by another reducer version, ahead of the journal's tail, or the repository has no journal record; an unknown repository is `404`, which the shipped client also maps to `null` |
|
|
781
781
|
| `putReducerSnapshot` (repo scope) | `PUT /repos/{repo}/snapshots/{reducer}` | `{"version": int >= 1, "cursor": int >= 0, "state": JSON}`, at most 16 MiB (`413` above) | `200 {"written": boolean}`; the stored cursor never decreases, so a write at an equal or lower cursor (or an equal cursor at an equal or lower version) and one past the journal's tail answer `written: false` |
|
|
782
782
|
| `appendRepoWithArtifacts` | `POST /repos/{repo}/deposits` | atomic deposit request | `201` + `{event, artifacts}` using repository shapes |
|
package/skills/operate/SKILL.md
CHANGED
|
@@ -282,7 +282,8 @@ that appear after you arm. Finishing the initially queued set is no reason to st
|
|
|
282
282
|
3. Handle each attention record using the shared rules. Repository records have
|
|
283
283
|
no build slug: inspect repository status. Re-arm from the standing watch's
|
|
284
284
|
latest cursor, including its trailing cursor after a timeout or count exit.
|
|
285
|
-
4. Report each merged, closed or aborted outcome
|
|
285
|
+
4. Report each merged, closed or aborted outcome, ending each report as *Keep
|
|
286
|
+
what waits on the human in view* requires, and file or move tickets when
|
|
286
287
|
warranted. An escalation requires action. Keep the standing watch
|
|
287
288
|
alive and keep discovering work until the human ends or hands off the role.
|
|
288
289
|
|
|
@@ -364,7 +365,10 @@ Read events with a cursor or a small `--events` count; logs are long.
|
|
|
364
365
|
longer conforms to the spec standard falls back to triage, and the comment
|
|
365
366
|
lists what is missing. `--reason` is quoted in the hand-back comment.
|
|
366
367
|
Cleanup is asynchronous: act on the `ticket.handed-back` repository event,
|
|
367
|
-
not on `build.aborted` or the build leaving `ab builds`.
|
|
368
|
+
not on `build.aborted` or the build leaving `ab builds`. Abort closes the
|
|
369
|
+
build's open escalations; do not acknowledge them afterwards. Only an
|
|
370
|
+
escalation raised after the abort (a cleanup failure) needs an answer.
|
|
371
|
+
Aborting an
|
|
368
372
|
optimization attempt is different: it settles `aborted` and its node moves the
|
|
369
373
|
ticket to the rejected role, so no hand-back is reported and `--to` has no
|
|
370
374
|
effect.
|
|
@@ -563,13 +567,14 @@ external harness belongs to that harness. Protocol session approval answers are
|
|
|
563
567
|
### Each round
|
|
564
568
|
|
|
565
569
|
Begin every operator round with `repository.attention`. One call returns
|
|
566
|
-
everything waiting on
|
|
570
|
+
everything waiting on the operator: blocked builds with their open escalation questions
|
|
567
571
|
(including done builds with an open escalation, which `builds.answer`
|
|
568
572
|
acknowledges while the build stays done),
|
|
569
573
|
merges awaiting consent or held, repository attention events after your cursor,
|
|
570
574
|
builds paused, stalled or failing verification, and dispatcher attention. Each
|
|
571
575
|
item's `resolve` names the tool call that acts on it, primary first; `by:
|
|
572
|
-
"human"` marks a condition you report rather than fix
|
|
576
|
+
"human"` marks a condition you report rather than fix; carry it in the Waiting
|
|
577
|
+
on you section (see *Shared rules*). Act on each item, then
|
|
573
578
|
pass back `events.cursor` next round. Omit the cursor on the first call to get
|
|
574
579
|
a baseline; on `code: "cursor-too-old"`, call again without one.
|
|
575
580
|
|
|
@@ -801,7 +806,9 @@ or a human decision is required.
|
|
|
801
806
|
|
|
802
807
|
### When to escalate instead of act
|
|
803
808
|
|
|
804
|
-
|
|
809
|
+
Don't act; ask the human — in plain streamed text — and keep operating
|
|
810
|
+
everything else. Carry the question in the Waiting on you section (below)
|
|
811
|
+
until it is answered. Ask whenever:
|
|
805
812
|
|
|
806
813
|
- The action is destructive and not clearly instructed (`abort`, `discard`,
|
|
807
814
|
a bulk control, a repository-wide setting).
|
|
@@ -818,6 +825,44 @@ Filing a ticket is acting — do it when the request is concrete. Default to
|
|
|
818
825
|
resolving attention yourself within these boundaries; ask the human only
|
|
819
826
|
for the exceptions above.
|
|
820
827
|
|
|
828
|
+
### Keep what waits on the human in view
|
|
829
|
+
|
|
830
|
+
This rule applies only to the agent that currently holds the operator role:
|
|
831
|
+
one that has taken the role and runs the standing operator watch, or, as a
|
|
832
|
+
connected agent, operates `repository.attention` rounds. It does not apply to
|
|
833
|
+
an agent that reads this skill to answer a one-off question, or to any other
|
|
834
|
+
role or session.
|
|
835
|
+
|
|
836
|
+
You keep working while the human is away, and each later message pushes an
|
|
837
|
+
earlier request out of view. So while anything waits on a human, every message
|
|
838
|
+
you send that reports status ends with a **Waiting on you** section: round
|
|
839
|
+
summaries, outcome reports (merged, closed, aborted) and replies to the human
|
|
840
|
+
alike. This holds the same way on the local CLI and as a connected agent.
|
|
841
|
+
|
|
842
|
+
What belongs in it:
|
|
843
|
+
|
|
844
|
+
- An escalation or decision only the human can make, including every case
|
|
845
|
+
under *When to escalate instead of act*.
|
|
846
|
+
- A merge waiting for the human's consent under the repository's merge policy
|
|
847
|
+
(`ab merges` locally, `merges.list` over MCP).
|
|
848
|
+
- A question you have put to the human.
|
|
849
|
+
- Attention you must report rather than fix: items marked `by: "human"` in
|
|
850
|
+
`repository.attention`, a merge only the human can perform on the forge, a
|
|
851
|
+
missing credential, or a dispatcher restart only a maintainer may perform.
|
|
852
|
+
|
|
853
|
+
Restate each item in full, so the human can act on the latest message alone:
|
|
854
|
+
the ticket and build, what is needed, the options, and your recommendation.
|
|
855
|
+
"See above" or any other pointer to an earlier message does not count.
|
|
856
|
+
|
|
857
|
+
Before you restate an item, confirm it is still open against current state:
|
|
858
|
+
the build's status (`ab build status <slug> --json`, `builds.get` over MCP),
|
|
859
|
+
pending merges (`ab merges`, `merges.list`), and the escalation itself. Never
|
|
860
|
+
repeat an item from memory.
|
|
861
|
+
|
|
862
|
+
Drop an item once it is resolved or no longer needs the human. When nothing
|
|
863
|
+
waits, end the message with one line saying so, such as
|
|
864
|
+
`Waiting on you: nothing.`
|
|
865
|
+
|
|
821
866
|
### Boundaries
|
|
822
867
|
|
|
823
868
|
- Automatic generation handoff is product behavior, not agent process authority.
|
|
@@ -1085,6 +1130,11 @@ slow cold resume of a stopped sandbox: retry, or suggest raising
|
|
|
1085
1130
|
`recoveryTimeoutMs` within the hosted invocation budget. `at step fence` or
|
|
1086
1131
|
`at step cleanup` points at sandbox or provider state worth checking before a
|
|
1087
1132
|
retry; `at step preserve` at the checkout, forge credentials or branch.
|
|
1133
|
+
A dispatch log line `build X: resume deferred by the invocation budget` (or
|
|
1134
|
+
`provision deferred`), counted as `recoveryDeferred` or `provisioningDeferred`,
|
|
1135
|
+
is normal: nothing is charged and the next invocation runs that build first.
|
|
1136
|
+
The same build deferring across several invocations means the hosted budget
|
|
1137
|
+
cannot fit that work: report it, and do not retry it.
|
|
1088
1138
|
|
|
1089
1139
|
Leaf restack and reconcile publication retry classified transient forge or transport
|
|
1090
1140
|
failures six times after the initial attempt, waiting 30, 60, 120, 240, 300 and
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"build": "ab-hosted-service-build"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@defrex/autobuild-hosted-store-service": "1.
|
|
8
|
-
"@defrex/autobuild": "1.
|
|
7
|
+
"@defrex/autobuild-hosted-store-service": "1.14.0",
|
|
8
|
+
"@defrex/autobuild": "1.14.0",
|
|
9
9
|
"next": "16.1.6",
|
|
10
10
|
"react": "19.2.4",
|
|
11
11
|
"react-dom": "19.2.4"
|