Commit graph

101 commits

Author SHA1 Message Date
Cristina Poncela Cubeiro
d406aa3946 docs: reserve L1 2026-08-06 13:26:38 +02:00
Mario Zechner
5cd46ee118 docs(agent): simplify harness work package workflow 2026-08-06 12:26:22 +02:00
Mario Zechner
fadb74f684 docs(agent): separate harness design from implementation status 2026-08-06 11:44:58 +02:00
Cristina Poncela Cubeiro
7f63f37832 docs: add missed JSONL matrix rows 2026-08-06 11:28:31 +02:00
Cristina Poncela Cubeiro
77f4840320
chore: qa2 tests (#7706)
* 1. rejects corrupt parent chains in array-backed readers

* 2. does not decode SQLite branch entries outside query bounds

* 3. validates SQLite entries before filtering and limiting branch results

* 4. does not validate SQLite ancestors beyond newest-first stop bounds

* 5. rejects repository operations and session writes after disposal

* 6. supports lexical ownership with await using

* 7. uses listing as a barrier between accepted session operations

* 8. waits for every accepted session operation during disposal

* 9. waits for accepted appends before disposal and rejects later writes

* 10. repository disposal closes its owned storage

* 11. stops branch traversal at retained-tail compaction

* docs: mark QA2 done
2026-08-06 11:24:09 +02:00
Cristina Poncela Cubeiro
9859eaa269 docs: reserve QA2 2026-08-06 10:09:01 +02:00
Cristina Poncela Cubeiro
2920265ea7 docs: update harness v2 md on how to use test matrix 2026-08-06 10:07:21 +02:00
Cristina Poncela Cubeiro
95bfbdc910 docs: mark QA1 done 2026-08-06 09:52:56 +02:00
Cristina Poncela Cubeiro
22db569a79 docs: harness v2 test matrix 2026-08-06 09:49:44 +02:00
Cristina Poncela Cubeiro
8ed232548e docs: reserve QA1 2026-08-06 09:45:18 +02:00
Vegard Stikbakke
69bab864d5 docs(agent): reserve harness v2 R3 2026-08-06 09:14:56 +02:00
Mario Zechner
6b461b75b3 feat: extract telemetry package 2026-08-05 23:23:12 +02:00
Mario Zechner
2c819a41ff docs(agent): align telemetry design with implementation 2026-08-05 22:43:23 +02:00
Mario Zechner
04d6447f7c feat: add typed telemetry contracts 2026-08-05 22:03:33 +02:00
Mario Zechner
459eb5eba8 docs(agent): finalize harness telemetry design 2026-08-05 21:06:29 +02:00
David Brailovsky
104364f4c5 docs(agent): mark JSONL J2 complete 2026-08-05 18:23:22 +02:00
David Brailovsky
e61d8f4f44 docs(agent): mark JSONL J1 complete 2026-08-05 18:15:36 +02:00
David Brailovsky
c7fc779408 feat(agent): complete JSONL codec contract coverage 2026-08-05 17:17:50 +02:00
Cristina Poncela Cubeiro
2f550d827d
fix: project open operation id to lanes (#7654)
* fix: project open operation id to lanes

* delete: idx_lanes_session_leaf

* fix: split, over-defensive

* delete: unnecessary assertion
2026-08-05 16:57:41 +02:00
David Brailovsky
b3ec7c0068 fix(agent): stop JSONL repositories from retaining sessions
Load storage for each create or open without caching it in the repository. Remove repository-wide serialization and disposal because write queues belong to returned sessions.
2026-08-05 16:52:14 +02:00
David Brailovsky
a79b22622a fix(agent): match coding-agent JSONL session layout
Store sessions under cwd-encoded directories with timestamped filenames, scan project directories for listing and explicit-id collisions, and skip global scans for generated UUIDv7 ids. Document and test the shared layout.
2026-08-05 16:06:34 +02:00
Cristina Poncela Cubeiro
7a103289d9 docs: f0 done 2026-08-05 15:54:48 +02:00
Cristina Poncela Cubeiro
14c89ad999 chore: UnavailableRegistry 2026-08-05 15:37:05 +02:00
Vegard Stikbakke
abac29f671 docs(agent): reserve harness R2 work package 2026-08-05 15:28:37 +02:00
Vegard Stikbakke
c518004666
docs(agent): clarify lane reduction contract (#7662)
The harness v2 plan is a bit underspecified for the state needed in R1. LaneState was missing the lane's config (model, thinking, tools). And the LaneReductionResult was missing, which is needed so we have failure information. Here's a suggestion at resolving.
2026-08-05 15:16:20 +02:00
Mario Zechner
2901362533 docs(agent): reserve harness I0 and L1-L3 work packages 2026-08-05 15:08:22 +02:00
Vegard Stikbakke
ea7bfdc08b docs(agent): unreserve R2 work package 2026-08-05 14:03:24 +02:00
Vegard Stikbakke
a5953d2e15 feat(agent): validate harness recovery record logs 2026-08-05 12:51:54 +02:00
Christian Klotz
1022a9e824
fix(agent): list SQLite sessions without writer claims (#7655)
* fix(agent): list SQLite sessions without writer claims

* fix(agent): reject null SQLite session names
2026-08-05 13:25:37 +03:00
Vegard Stikbakke
afdf73661b docs(agent): reserve harness R1 work package 2026-08-05 12:12:31 +02:00
Vegard Stikbakke
591f22a618
feat(agent): add indexed harness recovery queries (#7646)
Implements R0 of the harness v2 plan, which adds RecordQuery.operationKind filtering and adds Session.findOpenOperations() for recovery purposes. The in-memory implementation keeps the open-operation projections in memory. SQLite implementation adds an index idx_records_session_lane_run_id_type.
2026-08-05 10:41:44 +02:00
Vegard Stikbakke
f909da2bf0 docs(agent): reserve harness R0 work package 2026-08-05 10:11:40 +02:00
Cristina Poncela Cubeiro
a80008b96c chore: rename storage package to session-backends 2026-08-05 09:28:44 +02:00
David Brailovsky
0df5a69e5e docs(agent): harness-v2: count forked messages in session stats 2026-08-05 09:15:46 +02:00
Mario Zechner
588915ec71 docs(agent): clarify JSONL fork entry replay 2026-08-04 23:31:23 +02:00
Mario Zechner
b08e114f7a docs(agent): define harness implementation packages 2026-08-04 22:13:55 +02:00
David Brailovsky
4b85cd9786 harness-v2 mark task in progress 2026-08-04 15:08:44 +00:00
Mario Zechner
44289550aa feat(agent): promote durable harness API 2026-08-04 17:01:43 +02:00
Cristina Poncela Cubeiro
f119b01cb1
refactor: update sqlite for lanes (#7591)
* feat: align sqlite storage with session lanes

* fix: delete lane from entry, action

* fix: errors and types

* fix: tests

* fix: usage records instead of session materialized

* chore: 1 mig

* fix

* refactor(agent): move harness experimental changes to split branch

* refactor and cleanup

* fix: use assertJsonSerializable for session metadata

* fix(sqlite): reject corrupt lane leafs on open

* fix: rebuild cache

* refactor: branch cache

* feat: session stats

* fix: enforce leases

* feat(agent): enforce fenced SQLite writer leases

* fix(agent): keep SQLite transactions synchronous

* fix(agent): align SQLite storage with conformance suite

---------

Co-authored-by: Christian Klotz <hello@christianklotz.co.uk>
2026-08-04 15:56:56 +02:00
Mario Zechner
04133eb01b docs(agent): remove superseded design docs 2026-08-04 15:19:23 +02:00
Mario Zechner
4756e7d122 docs(agent): make harness v2 telemetry self-contained
Section 18 no longer references observability.md, which described the
superseded ALS/global-context mechanism and is being removed. Absorbed
the two load-bearing points: the multi-runtime rationale for rejecting
ambient context (explicit arguments are the only portable abstraction),
and the adapter framing - the application supplies ExecutionContext to
bridge spans into OTel/Sentry/logs/metrics, pi ships no exporter and no
vendor dependency, adapters allocate their own span/trace ids, and may
use AsyncLocalStorage internally. Dropped the reading-list entry.
2026-08-04 15:14:30 +02:00
Mario Zechner
b68decede0 docs(agent): fix coherence defects found by independent review
Full-document review by a fresh-context subagent found 2 blockers, 15
minors, and 12 nits; a second subagent verified every fix. All applied:

- autoCompact ran before_compaction only when no step was unfinished,
  making the hook unreachable on the live overflow path where the
  abandoned assistant step still occupies LaneState; now keyed on
  "not resuming a compaction step".
- Hook-supplied overflow compactions wrote no step_attempt, so the
  once-per-input guard never counted them and hook-driven compact-and-
  retry was unbounded; for reason overflow the hook path now writes the
  compaction step_attempt first.
- Empty compaction preparation is a real code branch, terminal for
  overflow. before_resume is invoked in the resume() dispatch. Pending
  deferred re-park verifies handle equality. resume() re-tags operation
  results as ResumeResult. MessageEntry declares terminate; options gain
  toolExecution; before_navigation loses its orphaned result fields;
  AbortRequestedRecord loses its unreachable reason field.
- Reduction bullets restated (newest-attempt closure, newest-own entry);
  Tier B records lane moves and covers the overflow and cancellation
  traces; hook-measured usage is written as hook ledger records at all
  three append sites; assorted stale wording from before the deferred-
  closure, ledger, and B2 changes brought current.
2026-08-04 15:07:26 +02:00
Mario Zechner
686f193e51 fix(ai): separate deferred request options 2026-08-04 12:45:00 +02:00
Mario Zechner
f7ea2ef38c docs(agent): resolve open questions, add mechanical test constructions
- Tier B: executable append-only-context assertion - every request in a
  run extends the previous request as an exact prefix, except across a
  compaction entry.
- Tier C: crash sites derived mechanically - snapshot the backend after
  every executeAction() of each section 6 trace, reopen and resume every
  snapshot, run recovery twice per snapshot.
- Section 15: fixed-point self-check as a production rule - after every
  resume() outcome, recompute the section 7 reduction and compare to live
  LaneState; mismatch faults the harness. Matching Tier C invariant.
- Section 19 becomes "Resolved questions": per-lane hook registration
  rejected (harness-global with lane field stands); replication stays out
  of scope - the append-only single-writer log replicates by log shipping
  if ever wanted. Cross-references in sections 1 and 11 updated.
- Section 21: implementation goes to src/harness/experimental/ with tests
  in test/harness/experimental/; everything under src/harness/ outside
  experimental/ is removed when the experimental implementation replaces
  it wholesale.
2026-08-04 12:06:53 +02:00
Mario Zechner
a0014c1a83 docs(agent): finalize harness v2 on the effects variant
Choose the effects variant as the harness v2 design: rename
harness-v2-effects.md to harness-v2.md with the decision rationale, delete
the rejected generator variant (preserved at 01eeafd1).

Fold in everything decided since the split:

- run/turn/step nomenclature and XxxRecord suffixes for op-log records
- restore rework decisions: TaggedError/matchError result surface, section
  18 ExecutionContext telemetry contract (with in-effect usage example),
  step_attempt.resultEntryId with stable structural ids, hook-durability
  wording, Models-level deferred API, typed record plumbing
- context-overflow/length handling per the superseding PR-7540 review:
  isRecoverableLength against the intended output cap, discard-don't-append,
  one recovery per conversational input, decline/nothing-to-compact
  terminal, Responses incomplete_details mapping, neutral truncation
  wording, crash-site table and test shapes
- UsageRecord cost ledger: union-shaped record (request/tool/hook/
  adjustment causes), cost durability independent of result durability,
  immutable entry usage snapshots with read-time effective cost,
  lane.recordUsage(), harness-global usage event carrying session totals,
  stats as ledger sum via maintained projection, fork/v3-import rules
- prompt normalization, deferred-fulfillment nuance, overflow guard
  reduction, ledger and overflow test coverage
2026-08-03 23:46:59 +02:00
Christian Klotz
f0deb8dd8e
Revert docs changes 2026-08-03 01:43:57 +03:00
Mario Zechner
01eeafd14a docs(agent): add durable queue-item cancellation to harness v2 variants
Queued steer/followUp/nextRun items get a durable identity and retraction,
mirrored in both design variants so the diff stays mechanism-only:

- queue_enqueued acceptance returns the provisioned entryId; snapshots and
  queue_update events carry QueuedItem { entryId, message }.
- New queue_cancelled record: without it, recovery would resurrect a
  cancelled item (record-without-entry restores as pending). Validity rules
  reject cancels of unknown or already-consumed items.
- cancelQueued(entryId) is one conditional mutation-line job; race-catalog
  row 12 covers cancel-vs-consume with exactly two histories. Reduction now
  also excludes abort-killed items (baseline omission).
- Adds the LaneRecord/NewRecord unions that sections 12/13 already
  referenced but section 5 never defined.

Adopted from the effect-durable-agent comparison (pending-message identity
and cancellation), trimmed to the minimal slice.
2026-08-02 23:09:59 +02:00
Mario Zechner
88ed89dbab docs(agent): split harness v2 into effects and generator variants
Replace harness-v2.md with two candidate designs that share Parts I and II
verbatim and differ only in the Part III stepping mechanism:

- harness-v2-effects.md: straight-line async procedures; deterministic
  stepping via a gated effect boundary (drive: "manual").
- harness-v2-generator.md: synchronous state machine; stepping via yielded
  actions and an execution controller.

Both fold in the fixes for the baseline defects found during the audit:
per-lane mutation line with conditional commits (finish/steer/abort/queue
races), nextRun capture at acceptance, terminal-failure recovery, terminate
persisted on tool-result entries, move-first navigation commit (closes the
open question, removes the only multi-object atomic write), corrected v3
normalization, and #7339-aligned deferred redemption.

Only one variant will be implemented; diff the two files to see the
mechanism trade-offs in isolation.
2026-08-02 21:51:15 +02:00
Christian Klotz
f07af611d3
feat(agent): compose session storage through repositories 2026-08-02 12:35:02 +03:00
Christian Klotz
a4c7cb025d
feat(agent): reject unsupported session search 2026-08-02 12:35:02 +03:00