Repository navigation
improvement(logs): cut recurring production log noise and fix the bugs behind it - #8871
Conversation
Trigger-mode blocks run through TriggerBlockHandler and never read a tool id, while their tool-mode sub-blocks (e.g. operation) are not serialized, so selecting a tool always threw and logged a fallback warning.
collectBlockData re-derived every block's output schema on each condition, function, agent, and reference evaluation, re-parsing an invalid agent response format and logging its full stack every time. Memoize the schema per immutable serialized block, attribute parse failures to the real block id, and log them at debug without the stack.
Service-account and managed-OAuth credentials (e.g. a custom Slack bot) have no OAuth account row, so the account-owner lookup always missed and warned on every webhook run. Skip the lookup for them and warn only when the credential or its account is genuinely missing.
… webhook A Slack bot without reactions:read fails reactions.get identically for every reaction event until it is reinstalled. Record that configuration state once per webhook per hour at info and keep the warning for other failures.
Deployed snapshots are immutable and re-sanitized on every load, so a field whose declared type later changed (e.g. dropdown to combobox) warned on every materialization forever. Log repairs at debug when the stored type is one some registered block declares; keep warning for missing or unknown types.
Listing, reading, and executing a catalog tool resolved the catalog gate with every custom block's input fields, which loads and sanitizes each custom block's deployed workflow per request. Tool scope only needs the block types (every custom block exposes workflow_executor), so tool reads use the lightweight overlay rows; block reads still derive the inputs.
…s without one A generic webhook without an idempotency header or configured field has no delivery identifier by design, so warning on every delivery was noise. Warn only when the provider normally extracts an id from the body.
items was typed json, so the LLM schema advertised it as an object and dropped its item schema with a warning on every schema build. Declare it as an array of 1-10 page objects; block-provided JSON strings still parse through parseItems. Regenerate tool metadata and docs.
…n strings json-typed block inputs also accept plain strings (a file id, URL, or reference) that are kept as-is, so parsing them could only fail and warn. Parse only text that can be JSON; every valid JSON text still parses.
…rovenance warnings Catalog responses (blocks, tools, connector types) carry no workspace data, so no producer records provenance for them and the per-request warning was noise. Skip them statically, and report a data-bearing route without a producer once per route per hour instead of on every request. Admission and recording behavior is unchanged.
encodingForModel only knows exact OpenAI names, so newer or provider-prefixed OpenAI ids fell back to cl100k_base (miscounting o200k models) and every unknown model built and cached its own copy of the rank table. Resolve exact names through js-tiktoken, newer OpenAI ids by family, everything else to cl100k_base, and cache one instance per encoding.
Every blocked request is an empty or tool user agent probing paths like /admin.php; the 403 is the whole response, so the per-request warning was pure ingest cost.
Forwarding to the external collector is best effort and the route still returns success, so a collector timeout or error is not an application error.
…to 502 The proxy logged nothing, passed an upstream 5xx straight through as its own 500, threw on a non-JSON upstream body, and returned a silent 500 when the admin key was missing. Log the method, environment, endpoint, status, and a truncated upstream body; answer upstream 5xx and unparseable bodies with 502; and log the missing-key misconfiguration.
PII batch masking, function execution request/success, sandbox mount resolution, table row queries and limits, usage-limit statistics, DAG builds, and mothership tool routing logged an info line on every call. They are diagnostic detail, not events, so log them at debug.
It is the diagnostic for stale-catalog 'No handler for tool' dispatches and in-band double-dispatch races, so it stays visible in production.
…hip proxy A gateway 502 now carries the upstream's error or message field, which the admin UI shows, and an empty 2xx body (e.g. 204) passes through as an empty response instead of failing JSON serialization into a misleading 502.
A non-OpenAI model threw and caught inside getEncodingNameForModel on every count. Cache the resolved encoding name per model id in a bounded LRU.
…oute table Derive each catalog pattern by matching its contract path against the generated v2 route table, so a renamed path parameter cannot drift from the pattern matchV2Route reports and silently restore the warning.
…clares them optional Header-based providers (GitHub, GitLab, Shopify, Linear, Svix) have no body extractor, so keying the warning on the extractor silenced exactly the anomalous case of their delivery header going missing. Providers now declare deliveryIdOptional; only the generic webhook does, since its deliveries carry no identifier unless an idempotency field is configured.
- Skip reactions.get entirely while a webhook's bot is known to lack the scope, instead of repeating a call known to fail. - Treat any intact sub-block whose stored type differs from the registry as drift, dropping the registry-wide type scan. - Move the JSON-candidate check next to isJSONString and trim once. - Make the catalog gate's cheap overlay rows the default; only block reads derive custom block inputs. - Collapse the admin mothership proxy's three copied handlers into one.
…the route table Extract the catalog route set into isCatalogRoute, built lazily from the catalog contracts resolved through the generated v2 route table, and test it against real request paths so a route or parameter rename cannot silently restore the missing-provenance warning.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
All reported issues were addressed across 38 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
Skipping the call for the cooldown window left a reinstalled Slack bot with empty reaction text for up to an hour. Keep the once-per-window log but always make the call. Block listing also uses the lightweight custom-block rows, since block summaries never read custom block inputs.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
- Drop the blockId option threaded through getEffectiveBlockOutputs; it only labeled a debug log. - Name the log-dedupe windows and cache ceilings. - Build the sandbox catalog route set by converting contract paths to the route table's pattern syntax; the route-table test guards drift.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
Cuts recurring production log noise, fixing the root cause wherever the noise came from a real bug. Each item lists what the logs showed and what to check in CloudWatch after deploy.
Root-cause fixes
operationaren't serialized in trigger mode, but the tool was still selected. Trigger-mode blocks now skip tool selection. Behavior change: theirconfig.toolis now''instead of an arbitrary fallback tool.TriggerBlockHandlerruns these blocks and never reads it. Watch: theSerializer"Tool selection failed" line disappears.collectBlockDatare-derived every block's output schema on each condition/function/agent/reference evaluation. An invalid agent response format was therefore re-parsed and logged with a full stack every time. Schemas are now memoized per (immutable) serialized block. The parse failure logs at debug without the stack (the editor lint already reports an invalid response format). Watch:ResponseFormatUtilswarnings disappear.generate_pages—itemswas typedjson, so the LLM schema advertised it as an object and dropped the item schema. A warning fired on every schema build. It's now anarrayof 1–10{ targetPageSlug, context }; block-provided JSON strings still parse. Regenerated tool metadata and docs. Watch: theToolsParams"items property ignored" line disappears.encodingForModelonly knows exact OpenAI names. Unknown models warned, and each built its own copy of a BPE rank table. Encodings now resolve by model family and are cached once per encoding; the model → encoding lookup is memoized. Behavior change: newer and provider-prefixed OpenAI ids (gpt-5.x, gpt-6.x,azure/gpt-4o) now count witho200k_baseinstead ofcl100k_base. Watch:TokenizationAccuratewarnings disappear.error/message; an empty 2xx (e.g. 204) passes through. Watch: the remaining failures carry a cause.Log-level and dedupe changes (no behavior change)
dropdown→combobox). Drift is now repaired at debug; missing or unknown types still warn.deliveryIdOptional. Only the generic webhook does, since its deliveries carry no id unless an idempotency field is configured. Header-based providers (GitHub, GitLab, Shopify, Linear, Svix…) still warn when their delivery header is missing.reactions.getmissing_scope— a bot withoutreactions:readfailed this call on every reaction event. It's now logged once per webhook per hour at info, and the call still runs, so a reinstalled bot gets text back on the next event. Other errors still warn.JSON.parseon plain strings (file ids, URLs, references) that can't be JSON. Every valid JSON text still parses./admin.php) is now debug. The 403 is unchanged. WAF logs (all requests) and ALB access logs still record this traffic.Deliberately not changed
OKstays at info for every successful request. A CloudWatch metric filter onmodule = "RouteHandler"feeds the API p90 latency alarm, and dashboards break down per-route latency and errors from these lines. Debug lines never reach OTel.error/failedtext, so the demoted lines simply stop cluttering them.Type of Change
Testing
serializer/index.edge-case-blocks.test.ts(trigger-mode tool id) andlib/tokenization/accurate.test.ts. Both were shown red on the pre-fix code.lib/mothership/tools/sandbox-catalog-routes.test.ts. Shown red when the catalog patterns drift from the route table.check:audits,docs-manifest:check,docs:check,tool-metadata:check, affected Vitest); CI green on the final HEAD.Checklist
test-auditauthoring gate)