Commit Graph

451 Commits

Author SHA1 Message Date
Peter Steinberger 568b920b21 feat(lint): enforce import ordering and deduplication (#124730)
* refactor(imports): dedupe and hoist imports

* feat(lint): enforce import/no-duplicates and import/first
2026-08-16 11:44:52 -07:00
Peter Steinberger f4871eb86b refactor(types): remove chained assertions in runtime boundaries (#124082) 2026-08-15 01:03:26 -07:00
Peter Steinberger 34efe370b2 test(core): trim duplicate strict-subset assertions (#124090) 2026-08-15 00:52:34 -07:00
Peter Steinberger d29a25e987 fix(logging): stop double-writing root log records (#123936) 2026-08-14 19:54:39 -07:00
Peter Steinberger d60a98ec87 fix(diagnostics): suppress startup-only heartbeat delay warnings (#123461)
* fix(diagnostics): suppress startup heartbeat delay warning

* chore: leave release changelog generation to release tooling
2026-08-13 21:42:11 -07:00
Peter Steinberger cb8e08f536 fix(logs): report line-limit truncation (#123358) 2026-08-13 16:57:26 -07:00
licheer-zte f24e164f69 fix(recovery): reclaim proven-stale reply-only ownership with zero queued backlog (#122265)
* fix(recovery): reclaim proven-stale reply-only ownership with zero queued backlog

Stuck-session recovery kept reply-only ownership forever when the queued
backlog was empty: isActiveRunProgressStale short-circuits to false at
queueDepth 0, so stale active_reply_work was never reclaimed even after
the durable session became killed. Evaluate staleness for reply-only
ownership without the queue gate (the gate stays for run-handle paths),
so proven-stale reply work expires through the existing abort-and-drain
owner path while global-lane and deferred-maintenance exemptions and
live reply work with recent progress are preserved.

Closes #122227

* fix(recovery): keep maintenance phases out of zero-backlog stale reclaim

The zero-backlog reclaim path (requireQueueBacklog: false) applied to
every reply-only operation, including preflight_compacting and
memory_flushing. Those phases are explicitly recognized as compaction
and may honor a configured timeout above the stale threshold, so a valid
long-running maintenance operation could be force-cleared early.

Restore the queue-backlog guard for the maintenance phases so an
unqueued compaction or memory flush is never reclaimed by this path;
ordinary reply-only ownership keeps the zero-backlog expiry. Adds
regressions for both maintenance phases.
2026-08-12 17:42:48 -07:00
Peter Steinberger dceb2c343c refactor: retire due compat-ledger surfaces (context-engine host params, deactivate alias, logging internals) (#121845)
* refactor(plugins): retire deactivate hook alias

* refactor(plugin-sdk): prune retired facade exports

* test(logging): isolate logger test controls

* refactor(logging): internalize file transport controls

* test(plugin-sdk): preserve retired facade coverage

* test(auto-reply): remove stale diagnostic imports

* refactor(logging): delete dead config-read guard

shouldSkipMutatingLoggingConfigRead had no production caller even on main;
it survived the dead-export scan only via logger's testApi re-export. The
test-isolation commit removed that mask, exposing the fossil. Delete the
guard, its test-only re-export, its mock entry, and its dedicated test file.

* refactor(plugin-sdk): retire due compatibility subpaths

* test(plugin-sdk): type group policy predicates

* refactor(plugin-sdk): split removed subpath records

* refactor(secrets): remove retired collector barrel

* test(plugin-sdk): tighten wildcard surface pin

* refactor(plugin-sdk): retire matrix facade metadata

* style(plugin-sdk): format facade metadata

* fix(ci): load channel setup contracts from source

Repair the main-owned regression from 99d662473c (Peter Steinberger): the new env-contract test could consume stale ignored dist metadata instead of the checked-in plugin declaration.

* test(plugin-sdk): refresh API baseline after rebase
2026-08-12 12:41:27 -07:00
wanyongstar d52a8b3475 fix(logging): parse diagnostics.stability limit/sinceSeq as strict decimal (#120446)
* fix(logging): parse diagnostics.stability limit/sinceSeq as strict decimal

normalizeDiagnosticStabilityQuery is the only input boundary of the
diagnostics.stability gateway method (no protocol schema), and its
string branch used Number(): "0x10", "1e3", " 5 ", "+42" were
silently coerced instead of rejected, so malformed clients could
filter snapshots by unintended seq values. String params now require
strict decimal digits, matching the boundary's fail-closed contract.

* fix(logging): reject unsafe integers for numeric stability query inputs

Replace Number.isInteger with parseStrictNonNegativeInteger for the numeric path so MAX_SAFE_INTEGER + 1 (and larger) is rejected uniformly across string and number inputs. Add test cases for MAX_SAFE_INTEGER (accepted) and MAX_SAFE_INTEGER + 1 (rejected) for both limit and sinceSeq.

* fix(logging): use normalization-core parser import

---------

Co-authored-by: Altay <altay@hey.com>
2026-08-12 20:31:06 +03:00
Peter Steinberger c23d66e3b5 refactor: consolidate coercion ownership (#122692)
* refactor: consolidate coercion ownership

* test: align shard check with weighted planning

* chore: refresh plugin SDK API baseline
2026-08-12 09:25:28 -07:00
Peter Steinberger b080dd1e76 refactor: consolidate coercion contracts (#122458)
* refactor: consolidate coercion contracts

Centralize exact string, record, numeric, date, Boolean, argument, and structured-error coercions while preserving call-site semantics.

Migrate canonical-name collisions and deprecated internal SDK bypasses, deleting 55 net production/tooling lines. Expand declaration ownership enforcement to 101 allowed helpers and add a narrow export-completeness audit.

* fix: preserve standalone script coercions

Keep copied Control UI tooling self-contained and retain the trusted release harness module-relative source seam when the harness runs against an old target cwd.
2026-08-11 23:26:37 -07:00
Peter Steinberger 964c8c84c1 refactor: consolidate coercion ownership (#122299)
* refactor: consolidate coercion ownership

Centralize four canonical coercion helpers, migrate exact core and plugin duplicates through narrow Plugin SDK facades, and enforce declaration and plugin-normalization ownership boundaries.

The sweep adds eight focused SDK exports while deleting more production and tooling code than it adds. User-visible behavior is unchanged except for safer equivalent object and UI parsing at existing boundaries.

* fix: guard integer option ownership

Register resolveIntegerOption with the canonical function owner and extend the declaration-guard fixture so future local duplicates fail validation.

* fix: keep integer helpers on numeric facade

Remove the unshipped duplicate string-coerce exports and route every affected plugin consumer through the existing number-runtime contract.

* fix: point numeric coercion to number runtime

Make boundary and declaration diagnostics recommend the canonical numeric facade, with failing-before coverage for both guidance paths.
2026-08-11 17:14:53 -07:00
wangmiao0668000666 9dc5a9a152 fix(logging): publish diagnostics ZIP through staged atomic overwrite (#122130)
* fix(logging): publish diagnostics ZIP through staged atomic overwrite

A named support export wrote the in-memory ZIP buffer straight to the
final path, so a failed or interrupted overwrite truncated the previous
archive, and an existing file kept its pre-existing (potentially
permissive) mode since writeFile only applies mode on creation.

Route publication through writeExternalFileWithinRoot's sibling staging:
the new archive is written to a private sibling, fsynced, and atomically
renamed over the final path. A failed publication leaves the previous
ZIP untouched with no staging residue, and the rename always installs
the staged file's 0o600 mode. The command now returns the actual
published path.

Fixes #122064

* test(logging): prove failed zip replacement stays atomic

* test(sqlite): create private reliability fixture

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-08-11 14:12:39 -07:00
Peter Steinberger 3d76246792 refactor: eliminate final export name collisions (#122083)
* refactor: resolve final export name collisions

* refactor: update remaining collision rename consumers

* style: format rebased auth helpers

* test: update remaining session entry mocks

* test: update remaining runtime mock exports

* test: update delivery info path mock

* refactor: reconcile combined collision sweeps

* chore: regenerate collision and sdk baselines
2026-08-11 11:18:24 -07:00
Peter Steinberger db73b59c04 refactor: burn wrapper shadowing baseline entries (#122040)
* refactor: burn wrapper shadowing entries

* chore: refresh wrapper shadowing baselines

* test: update secrets runtime state mocks

* fix(ci): absorb Control UI build identity variance
2026-08-11 08:24:03 -07:00
Peter Steinberger fa03d9b913 refactor: consolidate coercion helpers (#121366)
* refactor: consolidate coercion helpers

* fix: remove duplicate coercion imports

* fix: preserve serialized coercion guard

* chore: ratchet coercion helper carve-outs

* fix(test): keep gauntlet subprocess startup lean

* fix: preserve imported session timestamp semantics

* fix: preserve catalog timestamp string semantics

* chore: align plugin SDK surface ratchet

* fix: preserve trajectory and SDK string contracts

* fix(test): preserve QA record assertion semantics

* fix: complete standalone record guard rename

* refactor(cron): use canonical string coercion

* fix(acpx): preserve Pi timestamp parsing

* test(channels): adapt custody test harnesses

* test(telegram): classify media harness as test support

* test(acpx): split timestamp contract coverage

* test(channels): support generated custody contracts

* chore: ban the full coercion helper name set

Extends the declaration guard to all eleven consolidated helper names and
renames the cron schedule-identity readNumber wrapper to readScheduleInteger
so the banned generic name cannot regrow.

* fix(scripts): repair release-validation guard drift and lint cause

Restores the renamed isJsonRecord guard in assertTrustedWorkflowHarness after
main added isRecord call sites in parallel, and attaches the caught YAML error
as the thrown error cause (preserve-caught-error was red on main).

* fix: preserve Claude timestamp string semantics

* fix: preserve persisted timestamp string semantics

* fix: preserve date-first timestamp contracts

* fix(openai): harden delegation failure formatting

* chore: close coercion helper guard gaps

* test(openai): model non-error delegation rejection

* chore: refresh plugin SDK API contract

* fix(tasks): use canonical string field reader

* fix(ai): use canonical provider error field coercion

* fix(browser): migrate native bootstrap coercion

* docs(plugin-sdk): clarify text record export compatibility

* fix(gateway): normalize approval execution identity

* test(outbound): isolate message action poll harness
2026-08-11 00:02:18 -07:00
Peter Steinberger 3b828df2d9 test(logging): trim recovery duplicate coverage (#121864) 2026-08-10 22:10:26 -07:00
Peter Steinberger 11db07ac06 refactor(logging): remove dead console config fallback (#121776)
* refactor(logging): remove dead console config fallback

* test(logging): complete config module mock
2026-08-10 17:52:32 -07:00
Peter Steinberger f09a33ce41 Optimize OpenAI turn latency and simplify reuse (#121687)
Amp-Thread-ID: https://ampcode.com/threads/T-019fe95b-d75c-70fc-82b6-4825ca874826

Co-authored-by: Amp <amp@ampcode.com>
2026-08-10 16:23:06 -07:00
Peter Steinberger 8616c0c374 refactor: finish shared test helper migrations (#120996)
* test: finish shared helper migrations

* test: fix helper migration CI

* style: fix test import ordering

* test(acpx): restore deferred void types

* test: fix helper migrations after rebase
2026-08-09 06:00:06 -07:00
Peter Steinberger eecbfcc960 fix(infra): unify env-truthiness, missing-path, realpath, and abort-sleep semantics (#120359)
* fix(infra): unify environment truthiness

* fix(infra): unify missing path classification

* refactor(infra): unify realpath fallbacks

* fix(infra): unify abortable sleep errors

* docs(infra): clarify path fallback semantics

* fix(infra): route realpaths through policy wrapper

* fix(infra): ratchet plugin SDK wildcard budget

* fix(agents): preserve zero-delay abort precedence

* fix(infra): preserve fallback and media recovery contracts

* fix(plugins): share quarantine path resolution
2026-08-08 10:58:57 -07:00
joshavant 2253328618 fix(agents): centralize abort and progress authority 2026-08-07 18:42:57 -05:00
Josh Avant 8333892384 fix(agents): retain reply owners through cancellation 2026-08-07 18:42:57 -05:00
Josh Avant 8757119c77 fix(diagnostics): protect recovery authority 2026-08-07 18:42:57 -05:00
Josh Avant 90174086b3 fix(diagnostics): keep semantic provenance private 2026-08-07 18:42:57 -05:00
Josh Avant 32ad6834b1 fix(diagnostics): reserve semantic progress for core 2026-08-07 18:42:57 -05:00
Josh Avant b731aea7e1 fix: trust semantic diagnostic progress 2026-08-07 18:42:57 -05:00
Josh Avant 4ea4596617 fix: bind semantic progress to run owner 2026-08-07 18:42:57 -05:00
Josh Avant 474be1700d fix(diagnostics): preserve legacy progress liveness 2026-08-07 18:42:57 -05:00
Josh Avant be8a954032 fix(diagnostics): classify semantic model progress 2026-08-07 18:42:57 -05:00
joshavant 7bcdb5823e test: prove repeated request recovery through gateway 2026-08-07 18:42:57 -05:00
joshavant 517d0b1c2c fix: recover repeated model requests without progress 2026-08-07 18:42:57 -05:00
Peter Steinberger b4a26783f7 refactor(test): consolidate duplicated requireRecord and provider HTTP mock helpers (#119982)
* refactor(test): consolidate duplicated test helpers

* test: remove stale record guard import

* fix(test): remove orphaned record guards

* refactor(test): keep record requirement messages exhaustively typed

* fix(test): keep packages/ai record guard package-local
2026-08-06 14:48:01 -07:00
Vincent Koc c4292bc8b2 fix(diagnostics): report exporter health in doctor and status (#119816)
* fix(diagnostics): report exporter health transitions

* fix(diagnostics): retire exporter health on shutdown

* test(diagnostics): enforce OTLP protobuf content type

* test(diagnostics): satisfy exporter test type contracts

* fix(diagnostics): redact endpoint-like exporter codes

* fix(diagnostics): coordinate exporter route health

* test(diagnostics): satisfy exporter health static gates

* fix(diagnostics): keep exporter health internal
2026-08-06 20:50:18 +08:00
Jason (Json) 40b0b3da39 fix(diagnostics): bound recent phase attribution (#119625) 2026-08-05 10:14:33 -06:00
Vincent Koc 554a6f3bbf feat(sms): add Twilio MMS support (#118664)
* feat(sms): add Twilio MMS support

* fix(sms): harden hosted media bearer handling

* fix(sms): discard staged media before dispatch

* fix(sms): close staged media cleanup races

* fix(sms): finalize MMS metadata and race proof

* fix(media): bind local reads to authorized descriptors

* fix(sms): close MMS review gaps

* fix(media): make inbound root matching type-safe

* fix(media): route bounded reads through fs-safe facade

* test(media): satisfy async lint contracts
2026-08-04 05:46:37 +08:00
Peter Steinberger d347cd1097 refactor: canonicalize cache mechanics (#118262)
* refactor: adopt shared map pruning

* refactor: share config-scoped ttl cache

* refactor: share backup link cache

* refactor: centralize native relay retention cap

* chore: remove obsolete bundled channel lint suppression

* chore: shrink max-lines baseline

* refactor: remove cache pruning wrappers
2026-08-02 19:33:13 -07:00
Peter Steinberger 3f3ceb2def feat(gateway): track event-loop degradation persistence and add concurrency benchmark (#118193)
* feat(gateway): persist event loop degradation metrics

* fix(gateway): bound concurrency benchmark turn waits
2026-08-02 14:21:44 -07:00
Peter Steinberger e92a98c77d fix(agents): stop repeated equivalent terminal exec failures (#118071)
Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-08-02 11:42:57 -07:00
Peter Steinberger e46b4c34b0 fix(diagnostics): read active assistant context from canonical SQLite sessions (#117945)
* fix(diagnostics): read active assistant context from canonical SQLite sessions

* fix(logging): keep incognito transcript context out of diagnostics
2026-08-02 04:02:34 -07:00
Peter Steinberger a5b8b7052b fix(ui): preserve advanced cron delivery settings when cloning (#117909)
* refactor(ui): consolidate task and log contracts

* fix(cron): preserve advanced delivery routing

* refactor(ui): share relative-time bucketing

* fix(ui): retain narrow cron view types

* fix(ui): keep cron form field keys total

* style(ui): use narrowed task result boolean
2026-08-02 02:13:38 -07:00
Peter Steinberger 33ea3e16e9 refactor: consolidate core micro-helpers (#117825)
* refactor: centralize stable stringification

* refactor: reuse canonical record coercion

* refactor: reuse safe JSON parsing in cron storage

* refactor: centralize environment truthiness

* fix: enforce model scan and block reply timeouts

* refactor: consolidate signal-aware sleep helper

* fix: preserve plugin SDK sleep contract

* test: satisfy model scan timeout lint
2026-08-01 23:10:46 -07:00
Peter Steinberger 0ab2443692 fix(ui): eliminate core contract drift (#117817)
* fix(ui): eliminate core contract drift

* fix(ui): resolve cleanup contract checks
2026-08-01 22:10:22 -07:00
Paco Cartones cb3cd94756 fix(net-policy): redact sig and x-* auth params in URLs and bodies (#116957)
* fix(redact): redact sig and x-* auth params (redact-sensitive-url.ts)

* test(redact): redact sig and x-* auth params (redact-sensitive-url.test.ts)

* fix(redact): redact sig and x-* auth params (redact.ts)

* test(redact): redact sig and x-* auth params (redact.test.ts)

* fix(logging): unify URL credential redaction

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-08-01 10:04:13 +08:00
Vincent Koc b732322540 fix(logging): avoid Vitest exit listener leaks (#115929) 2026-07-29 22:37:30 +08:00
Peter Steinberger 20eda756fa fix(logging): scale heap pressure with V8 limit (#115153)
Fixes #104631.
2026-07-28 07:20:13 -04:00
Ho Lim 50f0e8d8ab fix(diagnostics): exclude active steering from session backlog (#114780)
* fix(diagnostics): exclude active steering from session backlog

Signed-off-by: Ho Lim <subhoya@gmail.com>

* fix(diagnostics): cover reply-run steering backlog

Signed-off-by: Ho Lim <subhoya@gmail.com>

* test(qa): prove active steering drains diagnostics

Signed-off-by: Ho Lim <subhoya@gmail.com>

* test(diagnostics): format reply-run steering coverage

Signed-off-by: Ho Lim <subhoya@gmail.com>

* fix(diagnostics): keep backlog policy internal

Signed-off-by: Ho Lim <subhoya@gmail.com>

* test(qa): isolate Talk diagnostics client

Signed-off-by: Ho Lim <subhoya@gmail.com>

* test(qa): close Talk client before diagnostics

* test(qa): reuse Gateway diagnostic RPC client

* test(qa): retry Talk steering admission

---------

Signed-off-by: Ho Lim <subhoya@gmail.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-27 20:01:22 -04:00
Peter Steinberger 1cbbda18c3 perf(logging): flush file transport asynchronously off the request path (#114769)
* perf(logging): flush file transport asynchronously off the request path

* fix(ci): record flushLogger surface growth and drain before log reads

- +1 public export/callable budget with annotation: logger file-transport
  flush for graceful shutdown drains; regenerate SDK API baseline
- three tests that read the log file right after logging now drain the
  async file transport first (flushLogger) instead of racing the flusher

* test: drain async log transport before reading talk and request-trace logs

* test: drain async log transport in CLI logger file tests

* test: drop unused withTempDirSync import
2026-07-27 19:40:43 -04:00
Peter Steinberger f0371e8d88 fix: stop blocked tool loops stalling until timeout (#114673)
* fix(agents): make global loop breaker reachable

Record loop-detector vetoes as typed no-progress outcomes so repeated blocked calls continue the existing streak without colliding with plugin or approval denials. Extract streak accounting into its own owner module and keep completed veto records out of argument reconciliation.\n\nFixes #109435.

* test: harden isolated project routing

Route registry-sensitive UI tests through the isolated project for both focused and broad runs, centralize the isolated file list, and register the Codex prewarm test in the full extension shard.

* test(qa): prove global loop breaker runtime

Drive 31 identical read attempts through the real QA Gateway agent loop and verify the typed veto streak reaches the global circuit breaker before the turn returns a final marker.

* test: keep isolated UI files out of shared runs

Always exclude registry-sensitive files from the shared UI project and reject broad watch targets that would span shared and isolated projects.
2026-07-27 16:02:28 -04:00
WhatsSkiLL 79c517df89 fix(agents): stop stable tool argument churn (#112620)
* fix(agents): detect stable tool argument churn

* fix(agents): refine argument churn evidence

* fix(agents): route argument churn through recovery

* fix(agents): reconcile rewritten loop arguments

* fix(agents): defer churn recovery across policy waits

* fix(agents): preserve churn clocks across policy waits

* fix(agents): harden concurrent churn policy tracking

* fix(agents): avoid stale churn false positives

* fix(agents): satisfy loop diagnostic CI guards

* fix(agents): normalize write churn outcomes

* fix(logging): order churn activity events

* fix(agents): classify churn no-progress outcomes

---------

Co-authored-by: IWhatsskill <284122573+IWhatsskill@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-07-28 01:34:37 +08:00