Commit Graph
1460 Commits
Author SHA1 Message Date
CI Test 4b140043bb test(ci): stabilize public CI shard validation 2026-10-05 19:21:50 +01:00
Alexandre Teixeira 2cc4b8a4b1 Merge commit 'refs/phase3/pre-ajax/publication-tip' into integration/pre-ajax-release
# Conflicts:
#	routes/chat_routes.py
#	routes/session_routes.py
#	src/agent_loop.py
#	src/agent_tools/filesystem_tools.py
#	src/teacher_escalation.py
#	src/tool_capabilities.py
#	src/tool_execution.py
#	tests/test_mcp_add_server_args_validation.py
#	tests/test_token_cache_atomic_swap.py
2026-10-05 15:59:59 +01:00
Alexandre Teixeira dab660543b chore(publication): close pre-integration release blockers 2026-10-05 01:37:49 +01:00
Alexandre Teixeira 80adeda937 fix(agent): honor explicit no-web requests 2026-10-03 04:02:59 +01:00
Alexandre Teixeira 18996588ff docs(tests): record Wave 6 parallel test measurements
Document opt-in local workers and the per-process runtime ownership model.
Record the two parallel-only failures found and fixed in test
infrastructure. Record the measured results on the final code: serial
oracle 496.3s, -n 2 267.6s (1.85x), and two green -n 4 runs at 155.6s mean
(3.19x), all with identical skip and xfail sets and no leaked processes,
listeners, state, or runtime roots. Recommend -n 4 locally and explain
why -n auto was not run. The full serial run remains the release oracle.
2026-10-03 03:46:53 +01:00
Alexandre Teixeira 77b61c222e test: serve browser assets without head-of-line blocking
The shared static server handled one connection at a time. Chromium can
open a speculative connection and never send a request, so every queued
request waited behind it. Under parallel load a computed-style capture's
navigation stalled for 30s and failed. Under CPU saturation, 4 of 12
captures stalled for about 29s each.

Serve each connection on a daemon thread. The existing serve-this-worktree
test now holds a silent connection open while it fetches, and times out
against the serial server. The configuration reference's recorded source
lines are unchanged.
2026-10-03 03:46:52 +01:00
Alexandre Teixeira 256beebb3d test: keep pytest basetemp within the AF_UNIX path limit
Moving TMPDIR into the private runtime root left pytest's default
<TMPDIR>/pytest-of-<user>/pytest-<n> beneath it. With xdist's popen-gw<n>
the real-tmux witness bound a 110-byte socket path, over Linux's 107-byte
sun_path limit, so it failed under every worker count while passing
serially.

The controller now roots basetemp at the private root's pytest directory;
xdist hands workers popen-gw<n> beneath it. An explicit --basetemp wins.
A tmux-independent witness binds a socket at the same path budget.
2026-10-03 03:46:52 +01:00
Alexandre Teixeira e1bc13b634 test: retain ownership of sockets and subprocess groups 2026-10-03 03:46:52 +01:00
Alexandre Teixeira 6eb0bbfe70 test: isolate pytest runtime defaults across workers and runs 2026-10-03 03:46:52 +01:00
Alexandre Teixeira a52c657150 test(web): repair negative security witnesses 2026-10-03 03:46:52 +01:00
Alexandre Teixeira decfab12f9 fix(tests): preserve bootstrap reference locations 2026-10-03 03:46:52 +01:00
Alexandre Teixeira 9fd6919ee9 fix(tests): isolate database and module state 2026-10-03 03:46:52 +01:00
Alexandre Teixeira 7563d859bc fix(effects): close independent review correctness gaps 2026-10-03 02:55:31 +01:00
Alexandre Teixeira da4bf3531f Merge frozen lab b1666951 (Wave 3) into Wave 4 effects provenance
Integrates the merged and frozen Wave 3 lab commit
b1666951faf8285054e1ca90f11533b0fb53fb57 with a normal merge, preserving
every Wave 4 commit unchanged.

Conflict: src/agent_runtime/resources.py. Wave 3's _control_plane_snapshot()
/ _control_plane_path(path, *, snapshot=None) split is kept. The snapshot adds
the effect-store directories to its prefix set after the recursive job-dir
inventory and no longer references path (the auto-merged prefix check would
have raised NameError there). _control_plane_path calls _aliases_effect_store
after its os.stat, only for multiply linked files, so single-link files never
list the store.

Semantic reconciliation (no textual conflict): bg_monitor keeps launch
settlement right after the first successful validate_job and before the
authority check, with Wave 3's post-drain revalidation intact. The
deleted-session branch, terminal before linkage validation, now settles a
validated launch too: that job is later pruned and its publication retired,
which would otherwise leave its effect RUNNING. Regression tests cover the
snapshot form of the effect-store check and both deleted-session linkage
outcomes.
2026-10-03 01:13:36 +01:00
Alexandre Teixeira 4d07e2da2d test(effects): close Wave 4 adversarial regressions
Real-seam coverage for each corrective fix, each checked by mutation:
requested edit/patch states (CRLF-exact, unrelated change contradicts,
partial read and underivable targets stay unverified, superseded effects are
history); directory and launch-index fsync order observed via real fsync
targets; dispatch refused when the directory fsync fails; independent
objects, threads and processes never reuse positions; settle-once and
recovery against another writer; torn-tail repair; unbound tools cannot
manufacture RUNNING/cleanup/facts or settle launches; external effects never
complete as satisfied, are always disclosed, and passing tests stay test
facts; verifier staleness and RUNNING launches without obligations;
known-scope child effects leave unrelated parent evidence fresh; browser page
refusal survives a matching approval and child authority with no claim, no
execution id and no producer call; effect-store hardlinks are caught without
scanning the store.

Replaces the uncommitted tests that asserted a CONTENT_CHANGED predicate and
blocking on any RUNNING effect.
2026-10-03 00:58:32 +01:00
Alexandre Teixeira b23c6d40b3 fix(effects): require evidence for external completion claims
Effect obligations were consulted only for declared artifacts, and reported
external success could be presented as done. Now, regardless of declared
artifacts:

- the latest effect on any changed file contradicted by a fresh readback
  fails the run (a superseded earlier effect is history, not a contradiction);
- a passing verifier followed by an effect that may have changed state
  without settled evidence is stale (BLOCKED);
- executed external effects that are not VERIFIED cap the decision at
  UNVERIFIED, and the answer always carries server-authored facts for them
  ("reported success; any external change it made was not independently
  verified", "reported failure", "unknown outcome").

The disclosure is structural and does not depend on recognizing the model's
wording. When it is the only change, the model's answer events are released
unchanged and the disclosure follows as one delta (and in round_texts).
Prose filtering is also tightened (remote verbs are mutation claims, an
unnamed "I updated it" cannot borrow the single required artifact, bare
"Done." is a terminal claim beside unverified external effects). A passing
verifier still supports test claims; it never speaks for the external effect.

Replaces the uncommitted attempt that blocked every run with any RUNNING
effect: a background launch with no declared obligations completes
UNVERIFIED.
2026-10-03 00:58:32 +01:00
Alexandre Teixeira 55d5b1d10a test(runtime): use live local control transport credentials 2026-10-03 00:10:24 +01:00
Alexandre Teixeira 721b5ca831 fix(runtime): retain malformed launch publications safely 2026-10-02 23:57:57 +01:00
Alexandre Teixeira 3d7d32dbe2 fix(runtime): preserve in-flight foreground attachment state 2026-10-02 23:48:41 +01:00
Alexandre Teixeira 3db903c336 fix(runtime): retain publications when recovery state is unreadable 2026-10-02 23:39:13 +01:00
Alexandre Teixeira 3834cd72b1 fix(runtime): enforce local control across Cookbook wrappers 2026-10-02 23:39:13 +01:00
Alexandre Teixeira bcc0e54e1b fix(runtime): revalidate background linkage before delivery 2026-10-02 23:26:01 +01:00
Alexandre Teixeira 6f2ae056c0 chore(runtime): close Wave 3 review nits 2026-10-02 23:23:40 +01:00
Alexandre Teixeira aefdd35d9b fix(runtime): preserve resource denial diagnostics 2026-10-02 23:23:40 +01:00
Alexandre Teixeira fab3c6a15d fix(runtime): terminate invalid background followups 2026-10-02 23:22:42 +01:00
Alexandre Teixeira 8d5ff852de perf(runtime): bound process launch validation cost 2026-10-02 23:22:41 +01:00
Alexandre Teixeira b89d178291 fix(runtime): restore authorized local control paths 2026-10-02 23:15:51 +01:00
Alexandre Teixeira 6094e2abe6 fix(runtime): tolerate unobservable fast-exit process identity 2026-10-02 21:21:20 +01:00
Alexandre Teixeira 87952c864c test(runtime): resolve the live tool registry in effect dispatcher tests
The dispatcher imports src.agent_tools at call time. Binding TOOL_HANDLERS at
test-module import left patches on a stale dict after another test reloaded
the module, so two tests failed only in full-suite order.
2026-10-02 20:30:41 +01:00
Alexandre Teixeira 75243fe0b0 fix(runtime): restrict running effects to launch results and index history
Only the native detached launch (bg_job_id) or a bridge's explicit detachment
marks an operation's own work as RUNNING. A listing that reports some other
download/model/job as running settled normally; treating it as running left
the claim pending forever and could block required artifacts.

EffectHistory now indexes outcomes per effect once, removing a cubic scan in
assessment over long run lineages.

Adds adversarial coverage: browser page operations stay fail-closed through
the real dispatcher with effects enabled (no claim, never dispatched),
scheduler task triggers stay unverified admission, and assessment scales.
2026-10-02 20:13:24 +01:00
Alexandre Teixeira 3953ea2444 feat(runtime): settle background launch effects from validated job lifecycle
The background monitor already validates the exact Wave 3 job linkage
(job_from_record + validate_job) before continuing a session. At that point it
now records the job's settlement against the durable launch claim through the
launch-generation index, using typed lifecycle facts from the server-owned
record. Settlement is idempotent across deferred retries, is execution
evidence only, and never reads the delivered output: the injected report stays
attributed content. Failure to record leaves the claim running/unknown and
never blocks the follow-up.
2026-10-02 20:10:46 +01:00
Alexandre Teixeira 8402c388b4 feat(runtime): claim effects before dispatch and gate completion on them
Dispatcher seam: mark_dispatch, which runs inside the live Wave 3 binding
scope immediately before backend invocation, now durably claims a possible
effect before execution_id is assigned. If the claim cannot be persisted the
action stays undispatched and the dispatcher returns BLOCKED; dispatched()
closes the never-awaited coroutine. record_action appends the outcome
(including cancellation/interruption) and admitted-read observations before
the receipt reduction drops producer facts.

Adapters consume only the bound operations the dispatcher admitted:
filesystem bindings give exact scope and predicates (write_file content digest
after fence unwrapping, apply_patch add/delete, edit existence); bash/python
launches have unknown scope with the launch generation as lineage; job kills
scope the exact job and its processes; owned operations scope their exact
revisioned records; external backends are claimed as external and never
verified by acknowledgement; browser session_info yields session lifecycle
observations only, and a page binding is never effect scope. Complete
read_file re-reads the exact bound source to digest it; offset/limit,
truncation, extraction and listings are partial. Background launches stay
RUNNING until an admitted read of the exact job generation (via a durable
launch index, across continuation runs) reports settlement.

Producer seams: typed job lifecycle facts on manage_bg_jobs reads/kills, a
structured timed_out flag on containment timeouts, and mutation_attempted on
in-place write_file/edit_file failures after truncation.

Completion: the existing EvidenceLedger consumes effect assessments through a
single helper used for the decision, ask_user and prose filtering. A required
artifact is unsettled by a later unresolved effect that may have touched it,
a fresh contradicting readback fails the decision, and partial reads no longer
count as artifact validation. Ordinary conversation and read-only turns are
unchanged; no second completion policy is introduced.
2026-10-02 20:09:35 +01:00
Alexandre Teixeira 9c4ed24296 feat(runtime): add durable append-only effect log with interrupted replay
Claims are fsynced to a per-lineage JSONL log before a caller may invoke a
backend; a persistence failure raises EffectPersistenceError (a
ResourceIdentityError) so dispatch fails closed. Outcomes and observations are
appended; nothing is rewritten. Reload validates every record strictly, ignores
only a torn final write, and fails closed on corruption, forgery or hardlink
aliasing. recover_interrupted appends INTERRUPTED/possible-impact outcomes for
claims that never settled and leaves RUNNING background effects alone.

The effect store is added to Wave 3 control-plane paths (prefix check only;
the log itself refuses aliased files), so filesystem tools cannot forge it.
Tests redirect the store to a session tmp directory.
2026-10-02 20:02:31 +01:00
Alexandre Teixeira c57aa7ad5c feat(runtime): recreate Wave 4 effect contracts on exact Wave 3 resources
Recreate (rather than cherry-pick 9012e208) the effect/provenance foundation.
The historical types used opaque string resource keys, a may_have_changed flag
defaulting to no impact, and a single status mixing execution and verification.

Claims, outcomes and observations now reference only typed Wave 3 identities
(filesystem root/inode/ancestor chain, process PID+start token, job generation,
owned revision, external incarnation, browser session incarnation). Browser
page resources are refused. Known no-op is limited to refusal before
invocation; unknown scope stays conservative; verification is derived from
fresh, complete, post-settlement readback checked against an explicit
predicate, and unknown execution with matching state is reported as observed
state without causation. Cleanup is recorded separately from effect outcome.
2026-10-02 19:45:39 +01:00
Alexandre Teixeira b7182fff54 test(runtime): clean Wave 3 validation warnings 2026-10-02 18:57:53 +01:00
Alexandre Teixeira 872888aa4a test(runtime): migrate Wave 3 legacy test suites to resource authority contracts
Migrate 28 legacy test failures to exercise behavior under valid sealed
RequestAuthority, native process reservations, sealed filesystem roots,
and external bridge contexts, or assert fail-closed unscoped behavior.
Preserves all design invariants without weakening production authority.
2026-10-02 18:54:09 +01:00
Alexandre Teixeira 29c31a4b24 test(runtime): verify deterministic refusal of unscoped remote scheduled SSH
Assert that raw scheduled remote SSH workloads without an exact external
backend binding fail closed deterministically with:
'Remote scheduled workload requires an exact external backend binding.'
2026-10-02 18:54:09 +01:00
Alexandre Teixeira cc14151d10 fix(browser): clean up owned browser daemons on shutdown after cancellation
Shutdown cleanup must not depend on active record.session capability,
which is cleared on cancellation. Guard cleanup by socket directory
presence so all owned daemons are terminated.
2026-10-02 18:54:09 +01:00
Alexandre Teixeira 896e1f8233 fix(test-isolation): prevent scheduler test from poisoning database globals
Use monkeypatch.setattr for engine, SessionLocal, ScheduledTask, and TaskRun
in _setup_isolated_db to ensure pytest restores real database engine state on
teardown, preventing downstream test failures like no such table: documents.
2026-10-02 18:54:09 +01:00
Alexandre Teixeira ab89e3274a fix(runtime): exclude stale process resources during authority intersection
Catch ResourceIdentityError during intersection so that normal process exit
or background job termination does not crash child authority creation.
Stale or unverifiable observations are conservatively excluded from the
resulting authority while maintaining identity verification and preventing
PID reuse or renewal.
2026-10-02 18:54:09 +01:00
Alexandre Teixeira e175bea752 feat(runtime): bind browser resources to authority 2026-10-02 18:54:09 +01:00
Alexandre Teixeira b648f9ddbe fix(runtime): isolate historical job lookup from PID reuse 2026-10-02 18:54:09 +01:00
Alexandre Teixeira db41d7e822 feat(runtime): bind process and job resources to authority 2026-10-02 18:54:09 +01:00
Alexandre Teixeira 7b8ac6f631 Merge lab after verified process lifecycle 2026-10-02 18:54:09 +01:00
Léo 2bda788311 ci: run the pytest suite as four parallel shards
The suite is 12.1k tests in a single CI job — nearly six minutes of pytest
that every push and every PR waits on in one block, on top of a setup step
that already installs npm, Playwright, FFmpeg and bubblewrap. Split it into
four sections the matrix runs in parallel: 352s becomes a 98s longest pole
locally.

Shards partition by test *file*, not by the area_* taxonomy markers. Those
markers do not partition the suite - a file can carry a hand-applied area_*
mark on top of the one conftest derives from its filename, so a marker-based
split would run those tests in more than one section. Assignment is a total
function of the file path instead, so every file lands in exactly one shard
and the four together run every test exactly once.

Sharding deselects rather than narrowing collection, so every test module is
still imported, in the same order, in every shard. The import-time stubbing
in conftest and the session-scoped static server behave identically whether
the suite runs whole or in sections - this suite has known collection-order
coupling and splitting by path would have walked into it.

Balance uses the existing `slow` marker as its weight signal rather than a
committed duration table that would go stale unnoticed. Files pack
heaviest-first into the lightest shard, which is deterministic for a given
file set, so every parallel job computes the same plan from the same commit.

Verified: the four shards together reproduce the full run exactly - 12141
tests selected across the four, and the same 59 failures, 78 skips and 2
xfails, by node ID and not merely by count.
2026-10-02 18:42:10 +02:00
Nicholai 2992bf6d36 fix(tools): publish blank-body files atomically 2026-10-01 20:18:33 -06:00
Nicholai 3a125dcce5 fix(tools): close empty-write races and preserve clears 2026-10-01 20:18:33 -06:00
Aashish 9056bac95b fix(tools): refuse an empty write_file body that would truncate a file
The handler opened the target in "w" mode without looking at the body, so a
call whose content section was lost by a parser cut the file to 0 bytes and
still answered exit_code=0 (#6414). Gate the truncating open on the size the
file has on disk — the read just above it answers "" for bytes it cannot
decode, so an undecodable target would otherwise look empty — and let only an
inline-JSON content key that is literally an empty string declare the clear.

Also stop turning a null content into the four characters "None", which could
be neither refused as a lost body nor honoured as an empty write.
2026-10-01 20:18:33 -06:00
Alexandre Teixeira 571f685ad5 feat(runtime): bind remote and owned resources to authority 2026-10-02 03:00:46 +01:00
Alexandre Teixeira 1bf45b9fed fix(runtime): reconcile lifecycle CI contracts
- Regenerate website/configuration-reference.md: Wave 5B moved the
  ODYSSEUS_BROWSER_SCREENSHOT_DIR read in web_tools.py (3458 -> 3479).
- Give the Chrome sweep regression fixture a real process identity (stat
  start time, boot id, process_ownership.PROC_ROOT). The sweep now signals
  only verified identities; the old cmdline-only fixture borrowed the
  identity of whatever real process held pid 101 on the host, so it passed
  or failed depending on the machine.
- Import pytest in test_workspace_artifact_tool_floor.py: its existing
  bubblewrap capability skip raised NameError on hosts without functional
  namespaces.

No production code changes. Required containment still fails closed.
2026-10-02 02:23:07 +01:00