π Planning: llm-ports v0.1.0-alpha.28 β Reliability + observability polish (four-consumer synthesis) #64
Replies: 1 comment
Alpha.28 scoping: observability contract foundationFiling a scoping update for alpha.28 (target 2026-08-05) after the cross-consumer review pass completed 2026-07-21. This narrows the release to a contract-foundation-only scope and points at the concrete implementation TDs already filed in this repo. What alpha.28 shipsA new package: The package contains only:
Zero runtime instrumentation at alpha.28. Adapters do not emit contract events yet. That work lands in alpha.29 (runtime instrumentation), alpha.30 (streaming + OTel), and alpha.31 (persistence + consumer cutovers). Rationale: get the contract right before hardwiring it. Concrete implementation deliverables (already filed as TDs)Five TDs in
Design decisions locked in for alpha.28
Related ecosystem discussions
For consumersThe alpha.28 scope is the taxonomy contract only. No runtime behavior changes. Your existing hooks ( Discussion open for scope pushback until the alpha.28 tag lands. ProvenanceCross-consumer review pass 2026-07-21 (BEPA + ADW as the two reporting consumers). |
Uh oh!
There was an error while loading. Please reload this page.
Status: Planning discussion. Target ship 2026-08-05 (two weeks after alpha.27). Extendable to 2026-08-19 if design questions surface.
Theme: Reliability + observability polish. Sixteen items synthesized from independent findings by four consumers (ADW, SalesCoach, BEPA, Dramma).
Prior release: alpha.27 (planned 2026-07-22; removes deprecated
instructions?/prompt?fields; see release plan).What ships in alpha.28
Sixteen items grouped by leverage. Every item is scoped β€200 LoC + tests; no item requires a design pass beyond the open questions below.
Cross-consumer items (multiple asks)
AttemptTimeoutError extends ProviderUnavailableErrorin@llm-ports/core. ModifieswithPerAttemptTimeoutinregistry.tsto catch the SDK-native abort at the wrapper boundary and re-throw asAttemptTimeoutError. Every consumer whoseshouldFallbackcatchesProviderUnavailableError(default OR aggressive OR custom classifiers that walk on it) automatically gets deadline-triggered failover. ~50 LoC.onComplete(event)hook (ADW C + SalesCoach C). Additive; fires alongsideonCost+onTokenUsage. Combined event payload: usage, cost, refs, operation, modelId, providerAlias, taskType, budgetScope, latencyMs. ~30 LoC.pricingOverrides(BEPA 10 + SalesCoach in-tree 4).createRegistryFromEnv({ pricingOverrides })accepts one global table; per-adapter overrides still supported (per-adapter wins). ~50 LoC.Reliability items
BudgetScopeRefto{ scope, scopeId, totalTokens?, totalUSD? }. Registry-level accumulator; throwsSessionBudgetExceededError. Composes with per-provider gates. ~150 LoC.learnConstraintsFromErrorto matchstatus === 400 && body.length < 20 && request.response_format?.strict === trueas ajsonModeUnsupportedcapability signal; triggers strict-mode downgrade retry. ~40 LoC.attemptValidationRepairwith fence-strip + brace-balance + trailing-comma repair + append-missing-}on truncation. Runs BEFORE retry-with-feedback; salvages truncated output without a round-trip. ~120 LoC. Unblocks SalesCoach's interview-agent migration + json-repair.ts retirement.timeoutMs/maxAttemptsoverrides (SalesCoach B). Optional fields on all 5 call-options interfaces; per-call wins over Registry default. ~40 LoC.runtimeFallbacktreatsEmptyResponseErroras transient-retry-then-fallback (retry same provider once, advance chain on second empty). Configurable. ~30 LoC.Observability items
registry.recentRetries(n)query API (Dramma 5). Ring-buffer of retry events queryable at Registry level; kills Dramma's hand-rolledretryHistoryarray and response-smuggling channel. ~50 LoC.@llm-ports/core(Dramma 8). Publishes theCostEvent/TokenUsageEvent/CompletionEventtypes explicitly so consumers can re-use them without re-declaring. ~10 LoC (type-level).Ergonomics items
pricingPolicy: "throw" | "warn" | "silent"(ADW F). Default"throw"(backwards-compat)."warn"logs apinowarning + treats cost as 0 withcostEstimated: trueflag on result. ~20 LoC.pricing: 'free'sentinel (Dramma 2a).AdapterRegistration.pricing: 'free' | ModelPricing; free adapters skip pricing lookups entirely. Extends Item 11's philosophy. ~15 LoC.tolerantKeylessAliases: trueincreateRegistryFromEnv(SalesCoach A). Skips provider aliases whose adapter is missing (with a structured warning) + prunes those aliases from route chains automatically. Kills SalesCoach's 40-linebuildSyntheticEnvworkaround. ~80 LoC.@llm-ports/expresshelper package withsignalFromResponse(res)(Dramma 7). Small QoL helper; kills three copies of theres.on('finish'/'close')block in Dramma. Own tiny package to avoid coupling core to Express. ~40 LoC.Consistency items
ValidationErrorwrapping across adapters (BEPA 7). Contract-test that every adapter surfaces schema validation failures asValidationError(from@llm-ports/core) withZodIssue[]preserved. Fix any non-compliant adapters. Kills BEPA's 5-level.causechain walker. ~80 LoC of contract tests + per-adapter fixes.attemptValidationRepair(BEPA 8). Walks any Zod schema; for every.enum()field, attempts case-insensitive match against enum values. If model returned"Low"and enum is["low","medium","high"], coerces. ~50 LoC + expanded tests.Open design questions (please weigh in)
Six questions consumers should signal on before implementation begins:
AttemptTimeoutErrorclass shape. SubclassProviderUnavailableError(existing classifiers catch it AND consumers caninstanceof AttemptTimeoutError) VERSUS wrap the abort as genericProviderUnavailableError(zero-classifier-change downstream). Recommendation: distinct subclass.budgetScope: { totalTokens, totalUSD }accumulation. Registry-level accumulator VERSUS backend-delegated (BudgetBackend.recordScopeUsagehook; enables Redis-backed cross-worker accounting). Recommendation: Registry-level for alpha.28; backend hook in alpha.30 alongside@llm-ports/budget-redis.onCompleteshape. Additive (fires alongsideonCost+onTokenUsage; consumer wires whichever it wants) VERSUS replace. Recommendation: additive.status === 400 && body.length < 20 && request.response_format?.strict === true) VERSUS loose. Recommendation: strict; document what triggers.pricingPolicy: "warn"default cost value. 0 with newCostUsage.costEstimated?: trueflag VERSUSNaN. Recommendation: 0 + flag.Four-consumer credit
Every finding here was filed by at least one production consumer during their alpha.20.1 / alpha.24 / alpha.26 audits. Consumers:
Full four-consumer synthesis: see alpha.27 release plan Β§A.11.6 (published post-alpha.27).
Cross-references
Post design-question answers below by 2026-07-31 for baseline scope; earlier is better.
All reactions