Commit Graph
5636 Commits
Author SHA1 Message Date
Peter Steinberger 83dce46a7d fix(update): preserve sealed service definitions during code updates (#131021)
Separate code-update ownership, effective launcher identity, native service control, and definition mutation. Guard actual definition publication before related config or token writes, and use the installed CLI's preserve-definition restart with renewed ownership and live port/version/build verification.

Consolidate unit/environment publication and conditional rollback, retain main's plugin convergence and fresh-Doctor ownership, and make post-core child termination belong to the winning completion path. Integrate current-main heap-argument provenance and process-marker handling; resolve the service Node from the executable rather than counting backward through flags.

Retain boundary-level sealed/writable/unknown/foreign, mount, platform, failure, and build-identity proof while consolidating redundant tests. The QA cleanup removes 399 maintained test/support lines; focused current-main integration proof passes 1,279 tests with one pre-existing platform skip. Production and installer growth remains +239 net.

Preserves the reviewed repair from ac86fdff61da9c0fea9f62da00a8c9f22df6790d while integrating main at 56d89073dd. No permission weakening, schema or lease policy change, deployment, or release.
2026-08-28 07:10:42 -07:00
Peter Steinberger f40e5f27a0 fix(test): prepare runtime before plugin batch readers (#131778) 2026-08-28 07:00:56 -07:00
Vincent Koc 1186e6a6f3 feat(release): seal full release candidate evidence (#131751)
* feat(release): seal full release candidate evidence

* fix(release): harden candidate evidence validation

* test(release): cover candidate digest tuples

* fix(release): retain candidate tooling closure

* test(ci): refresh release candidate guard inventories

* test(release): decouple candidate workflow fixture
2026-08-28 21:44:21 +08:00
Peter Steinberger 60dcc53827 chore(deps): refresh seven-day-cooled runtimes and tooling (#131719)
* chore(deps): refresh cooled runtimes and tooling

Refresh selections published strictly before 2026-08-21T02:01:28Z while preserving inherited dependency identities and existing policy.

* fix(build): keep meeting CLI metadata dependency-light

Keep Teams and Zoom metadata discovery out of the meeting runtime graph, preserve CLI descriptors and output modes, and remove the unused factory that has not shipped in a stable release. Import-boundary regressions fail before the repair; all 21 focused tests and normal metadata generation pass without changing render deadlines or concurrency.

Defer the OpenShell dependency bump until its separately owned host-gateway fixture repair is available. Retain the existing version and installer reference; do not ship a policy or test workaround.

* test(cli): type-check meeting metadata registrations

* test(plugins): sync CLI metadata snapshot mocks

Cover the config-wide snapshot and projection exports used by the current main runtime load context. The original fixture failed 19 of 25 tests after the progressive cache update (#131442); all 25 now pass on both main and this candidate without changing production behavior or assertions.
2026-08-28 06:38:50 -07:00
Vincent Koc 17a1225314 fix(release): preserve publish evidence identity (#131782) 2026-08-28 21:37:10 +08:00
Peter Steinberger b03d2e79e9 fix(sessions): prevent participant misattribution in Activity (#130986)
* fix(sessions): preserve participant identity and input provenance

Keep profile, agent, remote, observed, and legacy identities distinct in the existing participant table. Record accepted input at admission, including steering, instead of inferring a person from the session creator. Preserve historical membership and counts while leaving ambiguous profile timestamps unknown through stopped-writer Doctor migration.

Project full visibility-filtered person membership before preview limits so Activity does not misattribute channel identities or omit people outside the facepile. Keep participant membership separate from authorization and expose raw-selector ambiguity to memory operators.

Repair Doctor readiness reporting, generic Swift inline-union generation, direct-dispatch metadata handling, and fixture-owned database lifetimes. Verify namespace collisions, real provider input, accepted steering, visibility, backup/migration/reopen boundaries, native decoding, and the built-CLI lifecycle.

Fixes #130661

* fix(macos): isolate readiness and discovery lifecycles

Keep readiness fixtures private for their entire lifetime and give health readiness one deadline owner. Start and cancel slow host discovery with active discovery, not model construction.

Make native protocol, callback, onboarding, and process-cleanup tests observe their intended lifecycle phases without expanding deadlines or weakening assertions. Correct the documented signing default.

Validated with 1,839 parallel native tests, the release product build, causal negative controls, pinned Swift lint/format checks, and fresh isolated autoreview. Native production delta: -5 lines.

* docs(macos): clarify app profile isolation boundaries

* build(protocol): refresh generated Swift install models

* fix(protocol): preserve optional literal field presence

* fix(ci): bound SDK declarations and isolate test lifecycles

Discover the current declaration source graph in a joined child before normal eager emission, and track its complete source-bearing cache inputs. Repair shared jsdom focus teardown and native worker fixture request ordering without changing UI focus ownership or execution fallback policy.

* test(sessions): prove Goal participant upgrade boundaries
2026-08-28 06:04:18 -07:00
Vincent Koc 1454c60c18 fix(release): install cross-os baseline validation deps (#131756) 2026-08-28 20:28:25 +08:00
Vincent Koc ccbbaf2e2e fix(ci): accept broker-owned Crabbox identity (#131754) 2026-08-28 20:21:07 +08:00
Peter Steinberger b029a959db fix(update): avoid declaration build timeouts on dev updates (#131746) 2026-08-28 05:05:34 -07:00
70c44ce84d perf: per-delta cost grows with concurrent agent count because every delta walks every run's event listeners (#129174)
* perf(agents): index agent-event listeners by run instead of walking every run's closures

emitAgentEvent notified one process-global listener Set. Five subscribers
register a listener whose first statement discards other runs, so at N
concurrent runs every assistant delta walked N run-scoped closures to do useful
work in one of them - O(N) per delta, O(N^2) fleet-wide.

Add a runListeners bucket beside the global Set plus onAgentEventForRun, and
convert the five per-run sites (openai-http, openresponses-http,
cli-backend-dispatch, system-agent/agent-turn, acp-spawn-parent-stream), keeping
their runId guard as a harmless second check. Globals are notified first and
keep stock ordering; empty buckets are dropped on unsubscribe.

agent-job.ts stays global: it filters on stream, not runId.

* perf: route the shared CLI delivery bridge and approval wait through the run bucket

createAgentEventBridge and observeAgentRunApprovalWait still subscribed with
onAgentEvent and discarded foreign runs as their first action, so they kept the
per-delta cost this branch removes. The bridge is the highest-volume instance:
one CLI dispatch builds eight bridges from that shared factory, so N concurrent
runs left 8N run-filtered closures on the global set.

Both now subscribe with onAgentEventForRun. Their runId guards stay as a
fail-closed second check, matching the six sites already converted here.

Five remaining onAgentEvent callers are genuinely process-global (agent-job,
subagent registry, task registry lifecycle, plugin runtime bridge, TUI backend)
and are left alone.

* test(gateway): cover concurrent streamed agent events

Exercise token-authenticated Chat Completions and Responses streams through
the real Gateway, agent loop, local provider, WebSocket events, and agent.wait.
Expose existing startup diagnostics within the isolated test fixture.

Keep approval-wait subscriptions on the existing global path pending owner
review. This reduces the converted listeners' fanout but does not close the
remaining concurrency-dependent fanout issue.

Co-authored-by: Tran Quang <randytran8800@gmail.com>

* test: capture agent event ordering regressions

Exercise nested emission and unsubscribe through the real delivery bridge.
Prepare the existing runtime artifacts for the concurrent Gateway proof,
and correct its lint and formatting failures without changing its budget.

This diagnostic stage intentionally preserves the candidate dispatcher
until CI captures the ordering regressions; it is not ready to land.

Co-authored-by: Tran Quang <randytran8800@gmail.com>

* fix: preserve live order in run-indexed agent events

Merge global and matching-run subscriptions by registration order while
preserving live mutations, nested dispatch, and unsubscribe semantics.
Cover the observed delivery regressions and interleaved bridge isolation.
Run the authenticated concurrent-stream proof through the existing built
Gateway process harness with exact-checkout artifact provenance.

Related: #129173

Co-authored-by: Tran Quang <randytran8800@gmail.com>

* style: satisfy event dispatch lint rules

Use non-mutating sorting for the fresh listener cohort, initialize the
unsubscribe binding at its existing assignment, and distinguish unused
mapper parameters without changing the proved behavior or assertions.

Co-authored-by: Tran Quang <randytran8800@gmail.com>

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: Tran Quang <randytran8800@gmail.com>
2026-08-28 04:58:47 -07:00
Vincent Koc d3a5f2333e fix(ci): allow crabbox proof across forward main (#131738) 2026-08-28 19:41:40 +08:00
Vincent Koc 789e81162b perf(release): expose Windows upgrade timing evidence (#131727) 2026-08-28 19:37:30 +08:00
Vincent Koc c28cb02384 fix(release): resume failed validation without repeating green jobs (#128141)
* fix(release): resume failed FRV child attempts

* fix(release): harden FRV continuation controller

* fix(release): bind FRV continuation source evidence

* fix(release): support historical FRV source evidence

* fix(release): bind historical FRV source inputs

* fix(release): bind historical FRV source evidence

* fix(release): preserve historical FRV source identity

* fix(release): align FRV continuation CI checks

* fix(release): disable fail-fast for FRV continuations

* test(release): align FRV fail-fast expectation

* fix(release): classify missing FRV artifacts centrally

* fix(release): recover FRV state from workflow artifacts

* fix(release): overwrite recovered FRV plan artifact

* docs(release): clarify FRV plan recovery

* fix(release): harden FRV continuation recovery

* fix(release): revalidate FRV tooling ref before dispatch

* fix(release): authenticate historical FRV plans

* fix(release): fail FRV when temporary ref cleanup fails

* test(ci): update FRV workflow routing expectations

* fix(release): declare FRV workflow ref helper

* fix(release): keep FRV recovery on the same parent

* fix(release): verify original dispatch on parent recovery
2026-08-28 19:35:10 +08:00
Vincent Koc 240b485326 fix(release): bound FRV polling cadence (#131714) 2026-08-28 19:31:25 +08:00
Peter Steinberger 90a9622a6c refactor(test): centralize fixture cleanup and invalid-input cases (#131709) 2026-08-28 03:52:51 -07:00
3f749b97ca fix(update): route stored dev channel to the git update flow [AI-assisted] (#123083)
* fix(update): route stored dev channel to the git update flow [AI-assisted]

A package-detected launcher with a stored update.channel: dev resolved the
npm "dev" dist-tag (which does not exist -> ETARGET) because switchToGit
only honored an explicitly requested --channel dev. Base the decision on
the effective channel and collapse the duplicated selectedChannel/channel
computation, which is provably identical in every reachable case.

Refs #123073

* docs(update): state the dev-channel git contract in the routing comment

Review finding: "dev" can exist as a rare npm dist-tag, so the comment
must not claim it never does; the routing rationale is the documented
dev-channel git-checkout contract.

* fix(update): keep one-off --tag on the package path for stored-dev installs

--tag is documented as a one-run package-target override, so a stored dev
channel must not divert a tagged update into the git flow (where the tag
is ignored). An explicitly requested --channel dev still outranks the tag,
matching existing explicit-channel behavior.

* test(update): scope the package-to-git clone to a per-case OPENCLAW_GIT_DIR

The stored-dev routing case performs a real transactional clone. On the
default <home>/openclaw that directory outlived the case and made a later
test fail with "OPENCLAW_GIT_DIR appeared while cloning".

Test Plan: node --import tsx scripts/test-projects.mts src/cli/update-cli.test.ts
Failing set now matches clean origin/main exactly (3 pre-existing macOS
$TMPDIR symlink failures, unrelated to this change).

Assisted by an AI coding assistant; reviewed before submitting.

* test(update): verify stored dev routing on installed packages

Temporary expected-failure verification for #123073. Restore only the routing owner to its pre-fix bytes while retaining the original contributor commits and adding installed-package regression coverage. This head must not merge; restore the reviewed fix and require hosted green proof after capturing the intended failure.

* fix(update): restore stored dev routing after regression proof

Restore the contributor's canonical effective-channel fix after the
installed-package regression lane reproduced package routing for stored
dev. Keep one-off tags on the package path and explicit dev precedence.

Remove the obsolete source-text assertion now covered by installed CLI
behavior and format the CI documentation table. Preserve all original
contributor commits. Fresh hosted GREEN validation remains required.

Co-authored-by: Chinmayrawat15 <chinmayrawat15@gmail.com>

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: Chinmayrawat15 <chinmayrawat15@gmail.com>
2026-08-28 03:52:36 -07:00
Peter SteinbergerandAmp df905a6cb6 fix(sessions): preserve shared history across startup and repairs (#127241)
* fix(doctor): atomically repair session transcripts

* fix(sessions): keep runtime reads and repairs on SQLite owners

Resolve physical session databases once and carry that identity through startup, search, boards, maintenance, and Doctor. Remove automatic legacy JSON import from Gateway startup while preserving explicit Doctor upgrades.

Publish repaired legacy transcripts with strict atomic replacement and preserve the source when backup, write, or rename fails.

* fix(sessions): simplify startup ownership and diagnostics

* test(sessions): migrate legacy history through Doctor in CLI proof

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-08-28 03:32:53 -07:00
Peter Steinberger 51b857099f fix(plugins): keep Gateway available while upgrades await consent (#131290) 2026-08-28 03:27:47 -07:00
Vincent Koc 444bc22f0d fix(ci): let publisher own Crabbox proof (#131635)
* fix(ci): let publisher own Crabbox proof

* test(ci): narrow Crabbox workflow install step
2026-08-28 18:11:48 +08:00
Peter Steinberger 5a7e0b5153 refactor(test): couple watchdog release and completion (#131632)
* refactor(test): couple watchdog release and completion

* test: avoid redundant pre-allocation heap censuses
2026-08-28 02:40:19 -07:00
Vincent Koc b4117f26ac fix(ci): cache Robolectric SDK artifacts (#131628) 2026-08-28 17:27:52 +08:00
Peter Steinberger 0f6034bc3c test(release): seed plugin ownership for the installed schema (#131685) 2026-08-28 02:24:31 -07:00
Peter Steinberger 276483320d refactor: reuse strict numeric parsers in abort benchmark (#131662) 2026-08-28 02:09:59 -07:00
Peter Steinberger 6d04ee6e7d fix(plugins): prepare standalone source artifacts for native imports (#131615)
Add explicit source setup for already-built standalone plugin artifacts after source dependency pruning. Reuse guarded declared-host linking without rebuilding artifacts or changing compilation, managed installs, discovery, or Doctor behavior.

Fixes #131611.
2026-08-28 01:58:08 -07:00
Peter Steinberger b46fa46986 test(clawhub): serve audit metadata in install fixtures (#131673) 2026-08-28 01:57:43 -07:00
Peter Steinberger 4443a4a60c fix(ci): prepare shared release artifacts for every consumer (#131654)
* fix(ci): prepare shared release artifacts for every consumer

Derive the shared candidate preparation lanes from the release-path and plugin prerelease catalogs. Keep child execution scopes and immutable artifact verification unchanged. The executable workflow-step regression fails on the prior preparation path across beta, stable, and full profiles.

* test(ci): handle absent release planning job explicitly
2026-08-28 01:54:38 -07:00
f7a9a361d9 feat(comfy): support custom headers and per-request seed randomization (#130098)
* feat(comfy): support custom headers and per-request seed randomization

Local-mode ComfyUI requests only ever sent Content-Type, so a local
instance reachable behind HTTP auth (Basic auth, a bearer token) had no
way to authenticate. Add a generic headers config key, merged over the
plugin's own headers -- same shape as the ollama plugin's established
remote.headers pattern, rather than inventing a comfy-specific scheme.

Also add optional seedNodeId/seedInputName: without it, a static
workflow file's sampler seed never changes between submissions, so
every generation was silently identical whenever the operator's
workflow relies on a fresh random seed per run.

* fix(comfy): resolve headers through the SecretInput path, not plaintext-only

The new headers config accepted only literal strings, so a credential-bearing
value (Authorization for a gated ComfyUI instance) had no path to secret
storage -- unlike the existing apiKey field, which already resolves through
resolveSecretInputString with an env-backed fallback. Mirrors that same
pattern per-header, plus the ollama plugin's established header-secret
precedent: a header pointed at a SecretRef that can't be resolved fails the
request outright instead of silently sending it unauthenticated.

* fix(comfy): resolve non-env header SecretRefs, hide capability on unresolvable ones

resolveComfyHeadersConfig only ever resolved env-sourced SecretRefs (a
manual process.env fallback bolted onto inspect-mode); any file,
keychain, or plugin-backed reference always threw, despite the schema
and docs advertising the same SecretRef shape apiKey accepts. Now
resolves through resolveConfiguredSecretInputString (the same async
resolver the ollama plugin's own headers use) for the non-literal case,
so a real non-env credential provider actually works.

Separately, isComfyCapabilityConfigured returned true for local mode
without ever inspecting headers, so an unavailable Authorization
SecretRef advertised an image/video/music tool that would always throw
on invocation. Extends the same sync inspect-based veto
resolveComfyApiKey already applies for cloud mode's apiKey.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vk2cBRQdErwRtPea8VuhG6

* fix(comfy): don't veto a resolvable non-env header secret from provider selection

hasUnavailableComfyHeaderSecret treated any non-env SecretRef as
unavailable for the isComfyCapabilityConfigured gate, on the theory that
inspect mode can't confirm it -- but "can't confirm yet" isn't "won't
resolve": the async request path can and does resolve a real
file/keychain/plugin-backed ref. That made a perfectly valid,
already-working header credential permanently hide the image/video/music
tools from the agent, which is a worse outcome than a rare genuinely
broken ref surfacing its error at actual invocation. Only a definitely
missing/empty env var (decidable synchronously, no I/O) still vetoes.

Added a permanent committed integration test
(workflow-runtime.header-secrets.integration.test.ts) that proves this,
plus the env/non-env header resolution and fail-closed paths, over real
sockets with no SDK/ssrf-runtime mocking -- replacing the throwaway
proof script from the previous push, which was deleted after running and
therefore not rerunnable or reviewable.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vk2cBRQdErwRtPea8VuhG6

* fix(comfy): register header SecretRefs in the plugin secret contract

headers.* accepts and resolves SecretRef values, but the manifest never
declared configContracts.secretInputs for that path -- the canonical
plugin secret lifecycle (startup materialization, owner diagnostics,
audit/configure discovery, resolved-value redaction) only walks
manifest-declared paths, so this credential surface was invisible to
all of it despite working correctly at request time. apiKey doesn't
need the same declaration (it's covered by the separate, already-wired
provider-auth system via setup.providers.envVars/providerAuthChoices);
headers.* has no other declaration path.

Also fixes two smaller findings from the same review pass: the
seed-injection test asserted the freshly-generated seed is nonzero,
but randomInt(RANDOM_SEED_EXCLUSIVE_MAX) legitimately can (rarely)
return 0 -- a flaky assertion, removed; and documents that a configured
Content-Type header is ignored specifically on image-upload requests,
where the multipart boundary must come from the runtime.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vk2cBRQdErwRtPea8VuhG6

* docs(secrets): register comfy header SecretRefs in the credential matrix

The comfy plugin manifest change in e32863dc6cd registered
plugins.entries.comfy.config.headers.* as a secret-input target, but the
generated docs matrix and its paired markdown list weren't refreshed to
match, breaking the docs-sync CI check.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vk2cBRQdErwRtPea8VuhG6

* test(comfy): restore inherited header proof env

* fix(comfy): redact reflected request credentials across generation failures

Reuse the Ollama exact-header redactor through the provider HTTP SDK, scrub structured and truncated diagnostics before retaining them, and cover decoded Basic credentials observed in real ComfyUI proxy failures. Preserve optional header and seed behavior while consolidating tests and documenting the shared boundary.

Co-authored-by: Markus Hartung <mail@hartmark.se>

* fix(provider-http): handle optional Node header values safely

Skip undefined HeaderRecord values allowed by Node types and document the intentional omission of unsafe parser causes in the lint exception. Actual credential and no-header error behavior remain unchanged.

Co-authored-by: Markus Hartung <mail@hartmark.se>

* test(comfy): explicitly stringify reflected proxy header values

Keep the socket fixture compatible with the IncomingHttpHeaders union without changing its reflected-error behavior.

Co-authored-by: Markus Hartung <mail@hartmark.se>

* test(provider-http): register credential-safe parser error exception

Track the intentional preserve-caught-error suppression in the explicit inventory: raw JSON parser causes can quote request credentials. The focused inventory and provider HTTP tests pass; runtime behavior is unchanged.

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-08-28 01:40:22 -07:00
Peter Steinberger 364d02bae0 fix: avoid unnecessary filesystem probes during test selection (#131659) 2026-08-28 01:39:01 -07:00
Vincent Koc d5412d73ac fix(release): preserve frozen companion consent checks (#131649) 2026-08-28 16:35:09 +08:00
Vincent Koc 0a068cf3f1 fix(ci): let plugin prerelease own registry artifacts (#131639) 2026-08-28 16:18:39 +08:00
Vincent Koc 02e8d29231 fix(ci): bind Crabbox proof to publisher main (#131572) 2026-08-28 15:07:18 +08:00
Vincent Koc bccb649077 fix(release): support frozen plugin harness contracts (#131596) 2026-08-28 14:57:17 +08:00
f466dc0dcf fix(release): consent to staged Codex onboarding companion (#131298)
* fix(release): consent to staged Codex onboarding companion

* fix(e2e): prepare reviewed onboarding plugins explicitly

Use the shared command-help consent helper for the reviewed Codex and
external channel fixtures. Keep exact staged Codex versions pinned, use
official catalog selectors for published packages, and preserve historical
automatic setup when the candidate CLI lacks capability consent.

Replace source-order assertions with shell boundary coverage and document
reviewed plugin preinstallation before retrying noninteractive setup.

Co-authored-by: Dallin Romney <dallinromney@gmail.com>

* fix(e2e): preserve official provenance for candidate channels

Stage the selected Discord or Slack companion with Codex in the verified
prerelease registry and install its exact pinned npm spec after onboarding.
The former npm-pack path installed matching bytes but could not establish
the official provenance required by trusted plugin state APIs.

Remove local archive packaging and install overrides. Reject missing or
mismatched source companions before CLI use while keeping published catalog
selection and historical automatic setup unchanged.

Co-authored-by: Dallin Romney <dallinromney@gmail.com>

* fix(e2e): preserve frozen channel candidate registry

Keep the immutable Codex registry artifact unchanged and serve source Discord/Slack tarballs as separately validated exact npm packages. Remove source install overrides and fail closed without the mounted registry.

Co-authored-by: Dallin Romney <dallinromney@gmail.com>

* fix(e2e): keep candidate plugins in one registry

Restore the planner-owned immutable prerelease registry artifact containing Codex and the selected source channel companion. This supersedes the separate tarball mount follow-up.

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Co-authored-by: Dallin Romney <dallinromney@gmail.com>
2026-08-27 23:35:10 -07:00
Peter Steinberger f405fe19a4 test(ci): parse workflow fixture once per suite (#131587) 2026-08-27 23:31:58 -07:00
Peter Steinberger bf68de1df1 fix(test): synchronize descendant watchdog readiness (#131481)
* fix(test): synchronize descendant watchdog readiness

* fix(test): verify child readiness and final liveness
2026-08-27 23:26:38 -07:00
weiqinlandPeter Steinberger 0fef6319fa fix(usage): preserve agent ownership for matching session IDs (#128803)
* fix(usage): attribute named sessions to their store owner in all-agent list

The all-agent `sessions.usage` list labeled durable (store-backed) session
rows with whichever agent discovery surfaced, instead of the store owner.
When a subagent spawned from a session left a discovery transcript that
reused the parent sessionId, the Sessions dashboard card showed the
subagent's id (e.g. `scout-research`) instead of the owning agent
(`main`).

Resolve the owner from the durable store key via
`resolveSessionStoreAgentId`, re-resolve the owner's transcript file, and
de-duplicate by store key so a reused subagent transcript cannot shadow or
duplicate the owner row. Unnamed discovery-only sessions keep using the
discovered agent id.

Closes #128755

* fix(usage): reject cross-agent transcript fallback for named sessions

Address the ClawSweeper review finding on #128755: when owner transcript
resolution returned no file, the `?? discovered.sessionFile` fallback
could load the subagent's reused transcript under the owner row, leaving
attribution and usage totals inconsistent.

Resolve only an owner-associated transcript for store-backed named rows.
When the owner transcript is absent the row stays attributed to the owner
with no usage loaded (cold cache) instead of substituting another agent's
transcript.

Move the two #128755 regression tests into a dedicated
`usage.sessions-usage-owner-attribution.test.ts` so the existing
oversized test file stays under the max-lines limit, and add a case
covering the unresolved-owner path.

* fix(usage): bind transcript resolution to the durable store owner marker

Address the ClawSweeper re-review finding on #128755: the owner-file
resolver accepted a store entry SQLite marker by sessionId alone, so a
marker reusing the sessionId under a different agent (e.g. a subagent)
could still substitute that agent's transcript for a main-owned row.

Guard the resolver call: parse the store entry marker and only forward the
entry when its embedded agent matches the resolved owner. When the marker
belongs to another agent, drop the entry so the resolver falls back to the
owner agent's own transcript directory (or no file), never the subagent's.

Add a regression covering a durable row whose stored marker names a
different agent.

* fix(usage): drop redundant type assertion for store entry sessionFile

SessionEntry already declares sessionFile?: string, so accessing it
directly avoids a non-const type assertion. Restores the assertion-safety
ratchet (8 > 7 baseline) without changing behavior.

* fix(usage): validate entry marker agent in transcript resolver

Move the store-entry SQLite marker ownership check into
resolveExistingUsageSessionFile itself: matchingEntryMarker now requires
entryMarker.agentId to equal the requested agentId, so a subagent marker
reusing a parent sessionId can no longer be substituted for the owner
transcript. This lets the all-agent usage list drop its redundant outer
guard (and its non-const type assertion) and simply request the owner
agent, restoring the assertion-safety ratchet baseline.

Adds a regression test in session-cost-usage.test.ts covering the mismatched
agent marker path.

* fix(usage): preserve selected-agent ownership for global list rows (#128755)

- Only resolve durable owner for agent-scoped named keys; keep discovered
  agentId for global/unknown so a scoped request keeps its own global row.
- Add scoped-global list-path regression test.
- Add real-state remote-proof test (no internal mocks) logging the RPC trace.
- Add positive marker-match test; trim verbose comments.

* fix(usage): drop unused eslint-disable directive in remote-proof test

* fix(usage): resolve global durable rows to owner in all-agent lists (#128755)

ClawSweeper P1: all-agent discovery is newest-first, so a subagent transcript
that reuses a global durable row's sessionId could still relabel the row.
Resolve global/unknown rows to their logical owner in all-agent lists while
keeping the explicitly requested agent for scoped lists.

- Add all-agent global-row regression test.
- Add authenticated Gateway WebSocket proof test capturing the RPC trace.

* test(usage): restore gateway token env after ws-proof server

* test(usage): add real-Gateway UI e2e proof for #128755 owner attribution

Add a real-Gateway Control UI e2e test that seeds the #128755 scenario
(main owns the durable telegram DM row; an opus subagent transcript reuses
its sessionId, discovery-only) and drives a real Chromium browser against a
loopback token-free Gateway. The Sessions usage dashboard must attribute the
Telegram DM card to its store owner (agent:main), never to the reused opus
subagent, with no duplicate/shadow row.

- Asserts the .session-bar-row for agent:main:telegram:dm shows agent:main
  in its meta and no agent:opus row appears.
- Captures a redacted isolated dashboard screenshot when
  OPENCLAW_CAPTURE_UI_PROOF=1 (sanitized test fixtures, loopback, no tokens).
- Registered in the checks-ui-e2e-real-gateway CI lane and excluded from the
  standard ui-e2e shard via uiE2eRealGatewayTestFiles.

* fix(usage): bind owner transcript to canonical durable target (#128755 P1)

ClawSweeper P1: resolveExistingUsageSessionFile still received storeMatch.entry,
whose sessionFile can hold a cross-agent legacy JSONL path. resolveSessionFilePathCore
intentionally accepts absolute paths from other agents, so a main-owned row
carrying an opus path would be labeled main while the opus transcript loaded
into main's usage group.

Resolve via the canonical durable owner target instead: pass a complete
sessionTarget (owner agentId + sessionId + store key + owner storePath) so
resolveExistingUsageSessionFile validates owner identity and returns the owner's
canonical SQLite marker, never consulting the cross-agent legacy file.

- Add regression: owner target rejects an existing cross-agent opus transcript
  file on the durable entry and returns the owner's sqlite:main: marker.

* fix(usage): join sessions by agent and transcript identity

Carry projected session ownership into usage reporting and preserve independent
cross-agent transcripts with equal IDs. Scope historical-family suppression to
the same identity, retaining canonical aliases within each agent.

Replace re-attribution and deduplication branches with one owner-aware join.
Add real-state ownership coverage and retain real-Gateway browser proof.
Stabilize neighboring cache range coverage by awaiting its real refresh.

Fixes #128755. Refines #128803. Thanks to @yetisoldier for the report.

Co-authored-by: LiuwqGit <liu.weiqin@xydigit.com>

* test(usage): seed browser transcripts within the active date window

* test(ui): assert reader anchoring across transcript growth

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-08-27 23:13:44 -07:00
Peter Steinberger daf31a32dc fix(maintainers): preserve source coauthors in squash merges (#131570) 2026-08-27 23:10:52 -07:00
Peter Steinberger 9a38b5ec8f fix(test): clean fallback SQLite state after test runs (#131313)
* fix(test): clean fallback SQLite state after test runs

* test: make temporary-state fixtures ownership-aware

* fix(scripts): resolve test temp helper in native Node
2026-08-27 23:04:57 -07:00
Vincent Koc a33c8a5c0e fix(ci): route frozen FRV lint to matrix runner (#131376) 2026-08-28 13:46:28 +08:00
Vincent KocandPeter Steinberger d7b0e07f4c fix(sandbox): revert Daytona cloud sandbox plugin (#130996)
* fix: remove Daytona sandbox plugin

Retire the unshipped cloud sandbox provider and its exclusive dependency closure; preserve Crabbox and standalone Daytona hosting documentation.

Co-authored-by: Peter Steinberger <steipete@gmail.com>

* test(ui): await catalog terminal restore completion

Wait for catalog RPC dispatch and pending-intent completion before asserting exactly one restored terminal. Reuse the request filter without weakening payload, activation, or cache checks.

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-08-27 22:31:04 -07:00
Peter Steinberger 648d0c43c8 fix: reuse package-local plugin memory artifacts (#131538) 2026-08-27 22:22:21 -07:00
Vincent Koc d4c1acb59c fix(ci): restore Crabbox publisher credentials (#131535) 2026-08-28 13:13:18 +08:00
Peter Steinberger d83a53dd2f fix(ui): avoid standalone validator startup stalls (#131497)
* fix(ui): avoid standalone validator startup stalls

* test(ui): preserve fixture env overrides on Windows
2026-08-27 21:44:06 -07:00
Peter Steinberger 02f56eb6ce ci: replace hand-fitted shard timings with committed measurements (#131379)
* ci: use committed measurements for test sharding

Regenerate UI file and runner-specific compact weights from successful CI log medians, with outlier filtering and a 15% write threshold. Keep existing hints as cold-start fallbacks and account for per-file UI overhead without deriving membership from timing keys.

Add a daily standing-PR refit workflow, strict cached loading, fixture coverage, and operator docs. Verify all 302 UI files form identical complete partitions across 22 fresh processes.

* fix(ci): prune stale test timings and trust runner labels

Remove unobserved timing keys only after three sampled runs and report removals in the refit table. Bucket compact measurements using jobs API labels and include all main run attempts without counting retries as independent samples.

Document contended compact walls and the hosted cold-start fallback. Preserve committed timing data and existing sharding behavior; verify 70 focused tests, all 11 UI shards, five corruption fallbacks, live refit, changed checks, workflow checks, and Codex autoreview.

* fix(ci): prune timings per profile with observed evidence

Pruning used one global run count, so a profile with no observations in
the sampled window had its whole committed map deleted. Hosted weights
could never accumulate, and a partial log-fetch failure could drop every
UI E2E entry in a single refit.

* fix(ci): keep preflight timing validation dependency-free

PR preflight builds its manifest with bare Node before dependency installation. Replace the timing schema dependency with strict all-or-nothing validation and preserve the CiTestTimings type.

Walk workflow-derived planner imports in a bounded, cycle-safe regression guard. Keep the refit CLI outside that dependency-free boundary, and document the coercion-helper exception for preflight.

* test(ui): settle typography picker popup animations

* fix(ci): guard timing refit sampling and publication
2026-08-27 21:42:00 -07:00
Vincent KocandPeter Steinberger ec3a8343c5 fix(ci): keep plugin fixture validation compatible with capability consent (#131208)
* fix(ci): accept plugin fixture capabilities

* fix(ci): detect fixture capability consent support

Probe candidate command help through the existing bounded E2E runners so
positive fixtures accept capabilities only when that command supports it.
Preserve historical packages, probe failures, argv, and child exit status;
keep negative, no-op, and integrity-bound update coverage unapproved.

Replace duplicated probes and source-string checks with executable
compatibility regressions. Synchronize the RPC timeout test with real
process readiness before advancing its unchanged 100 ms deadline, while
retaining real process-group termination and cleanup.

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* fix(ci): run Docker lanes from trusted harness

Resolve package scripts and packaging tools from the trusted harness while
keeping candidate source, artifacts, registry identity, and preflight on
the frozen target. Remove candidate-script lane filtering and the duplicate
live command wrapper; preserve source inputs in source-built Docker lanes.

Prove the public scheduler boundary with distinct harness/target roots and
poisoned candidate scripts. Synchronize scheduler timeout fixtures with real
child readiness, retain real signals and kill grace, and handle empty QR
build arguments on Bash 3.

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* test(ci): retire superseded harness source assertions

Keep the workflow trust and pnpm PATH guards, but remove checks for the
old inline replacement and deleted duplicate live-script wrapper. The
public scheduler regressions now prove those behaviors through distinct
candidate/harness roots and quoted pinned pnpm commands.

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* test(ci): cover multi-build source roots

* fix(ci): select the harness toolchain before Docker lanes

Start prepared pnpm commands in the trusted harness before Corepack resolves
its package-manager pin. Preserve frozen candidate source and artifact
identity, and resolve relative executable and cache paths before changing cwd.

Keep quoted rerun environment values out of executable substitution. Cover
different toolchain pins, shell-sensitive paths, and generated reruns through
the public scheduler boundary.

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-08-27 21:34:12 -07:00
Peter Steinberger b5885ac0ef fix(tooling): keep UI baseline hints off shared tsx caches (#131516) 2026-08-27 21:33:23 -07:00
Peter Steinberger 099fc6b056 fix: preserve Control UI assets during source rebuilds (#131477)
Keep Vite-owned dist/control-ui output through TypeScript wrapper cleanup
while still removing stale runtime chunks and plugin staging. Source
launcher and gateway-watch rebuilds retain the existing UI; UI edits still
need ui:build or ui:dev.

Replace the mock-only launcher assertion with real preparation-boundary
coverage, consolidating declaration and startup-metadata cleanup cases.
Historical context: Control UI preservation repair #10146.
2026-08-27 21:16:59 -07:00
Peter Steinberger eda219c4c2 perf(plugins): keep state-db write machinery out of metadata read paths (#131417)
* perf(plugins): keep state-db write machinery out of metadata read paths

Metadata-only CLI reads (openclaw plugins list --json and friends) loaded
the full Kysely-backed state-db graph (~250 modules) through three
read-path fusions. Split them, behavior-neutral (module layout and
imports only):

- installed-plugin-index-store.ts now only reads/parses; the write,
  restore, and refresh functions move verbatim to
  installed-plugin-index-store-write.ts (write transactions are sync per
  the SQLite commit doctrine, so this is a module split, not a dynamic
  import). Writer callers and test mocks route to the write module.
- refreshPluginRegistry moves out of plugin-registry-snapshot.ts into
  plugin-registry-refresh.ts, and the plugin-registry.ts barrel no
  longer re-exports it: ESM evaluates every barrel re-export source, so
  that one writer re-export dragged the write graph into every barrel
  consumer on the metadata path.
- openclaw-state-db-readonly.ts no longer imports the heavy
  openclaw-state-db.js module: cache-trio calls go straight to
  openClawStateDatabaseCache, constants come from
  openclaw-state-db-contract.js, and
  registerNodeSqliteKyselyQueryErrorHandler moves into
  kysely-sync-cache-state.ts (that module's stated charter). Doctor and
  gateway schema preflights read OPENCLAW_STATE_SCHEMA_VERSION from the
  contract module instead of value-loading the heavy module; the
  now-dead wrapper exports are deleted or un-exported.

Module-load census on the built CLI (module.registerHooks recorder,
isolated HOME): the installed-plugin-index / manifest-registry / store /
readonly / snapshot chain no longer imports the openclaw-state-db chunk,
and the write module does not load on plugins list --json. kysely itself
still loads via the separately owned config-io fusions (io.health-state,
legacy-config-migrations -> config-machine-state,
sqlite-audit-record-store, cron store) - the remaining named follow-ups
from #131181.

Named follow-up from #131181 (f49d25052e).

* test: reroute state-db test imports to contract and cache modules
2026-08-27 20:46:29 -07:00
Vincent Koc a03cc38b05 feat(ci): add admin-only Crabbox PR gate fallback (#131091)
* feat(ci): add admin-only Crabbox PR gate fallback

* fix(ci): satisfy crabbox publisher lint

* fix(ci): accept bounded crabbox event previews

* fix(ci): revalidate protected main before gate publication

* fix(ci): preserve aggregate gate semantics

* fix(ci): trust GitHub job metadata for bypass

* fix(ci): allow Crabbox proof on draft PRs

* test(ci): type Crabbox workflow steps

* fix(ci): bound Crabbox AWS gate lease

* fix(ci): focus Crabbox gate proof

* fix(ci): derive Crabbox proof from PR changes

* fix(ci): repair Crabbox gate validation checks

* fix(ci): accept portable timeout behavior
2026-08-28 11:45:46 +08:00
Peter Steinberger 16b0c1f251 fix(live): repair model E2E selection and session fixtures (#131229)
* fix(ci): accept valid focused live suite selectors

Match exact provider and media shard IDs to their enabled matrix profiles. Exercise the actual validator against all emitted suite selections.

Fixes #131204.

* fix(ci): forward DeepSeek credentials through live test hydration

* fix(ci): run local TTS live tests on the media runner

* test(moonshot): honor replay models and asynchronous stream contracts

* test(memory-lancedb): verify exact duplicate memory results

* test(skills): create valid sessions for experience review

* test(live): use current provider models and thinking capabilities

* fix(gateway): avoid pending model switches on new sessions

* test(gateway): advertise trajectory approval rendering capability

* test(setup): retain redacted inference failure diagnostics

* refactor(gateway): reuse unavailable model catalog handling
2026-08-27 20:09:39 -07:00