Title: fix(logs): restore workflow input on log details for runs without secret provenance by mzxchandra · Pull Request #6278 · simstudioai/sim · GitHub
Open Graph Title: fix(logs): restore workflow input on log details for runs without secret provenance by mzxchandra · Pull Request #6278 · simstudioai/sim
X Title: fix(logs): restore workflow input on log details for runs without secret provenance by mzxchandra · Pull Request #6278 · simstudioai/sim
Description: Summary Workflow Input JSON renders empty on the logs page for a large class of executions. This restores it on the read path. Root cause. PR #6000 added a resolved-secret gate to the log display projection. When a run's persisted resolvedSecretTraceProvenance is absent or incomplete, projectTraceSpansForSecrets returns structural-only spans, which stripped the entire display envelope - including workflowInput and finalOutput. Every run written before #6000 has no provenance key at all, so all of them went blank at once. The data was never lost; it is intact in storage and functional readers see it fine. Fix (fix(logs): restore workflow input ...). The display envelope is split in two: Gated (finalOutput, blockInput, blockExecutions, error, errorDetails, completionFailure, message) keeps the existing #6000 gate and fails closed. Trace-span redaction is untouched. Boundary (workflowInput only) goes through a new projectWorkflowBoundarySpansForSecrets. With complete provenance it is byte-identical to the current matcher path; with absent or incomplete provenance the content survives instead of collapsing to structure. workflowInput is exempt because an inbound trigger payload is captured before any secret is resolved. That premise does not hold for nested runs - a workflow or custom_block execution is handed workflowInput assembled from its parent's already-resolved block outputs (workflow-handler.ts:578), so those keep the gated treatment. The check is a denylist of nested trigger types, because webhook runs record the provider (zoho_desk, slack) as trigger.type and an allowlist of "known inbound" types would fail closed on exactly the population this fixes. Runs predating top-level workflowInput persistence recover it from the trigger block state, gated on an absent provenance key plus present block states - together these identify pre-stamping data without dating the row. Recovery refuses when more than one block state matches the trigger shape, because a paused run carries a resume placeholder with the same executed:false / executionTime:0 / output != null shape and its capability URL must never render as the workflow input. Refactor (refactor(logs): extract the legacy workflow-input reader ...). extractLegacyWorkflowInput moves out of execution-state.ts into a shared module so the display path can use it without a circular import. The functional re-run reader keeps first-match behavior; only the display path refuses to guess. Deliberately not in scope: finalOutput fails closed. It sits downstream of every block and can carry a resolved secret, and on the incomplete path there is no matcher to redact with. Test Coverage CODE PATHS TESTS [+] lib/logs/execution/legacy-workflow-input.ts (new) ├── extractLegacyWorkflowInput() (moved verbatim) │ └── [★★★ TESTED] execution-state.test.ts (pre-existing, still green) ├── hasPersistedBlockStates() │ └── [★★★ TESTED] empty {} | missing key | non-record | no executionState ├── isNestedInputSiblingClone() │ └── [★★★ TESTED] clone shape kept flat vs superset shape narrowed └── recoverLegacyWorkflowInputForDisplay() └── [★★★ TESTED] narrowing, token drop, non-record passthrough, ambiguous-shape refusal (HITL resume placeholder) [+] lib/logs/execution/trace-secret-projection.ts └── projectWorkflowBoundarySpansForSecrets() └── [★★★ TESTED] complete → delegate | absent/incomplete → clone | clone exceeds limits → structural fallback [+] lib/logs/execution/trace-store.ts └── projectExecutionDataForDisplay() ├── [★★★ TESTED] boundary/gated split, recovery gate (3 conditions) ├── [★★★ TESTED] nested workflow/custom_block gated; provider webhook exempt └── [★★★ TESTED] traceSpans array vs malformed; empty-envelope short-circuit COVERAGE: 22/23 paths (96%). The one uncovered path is a defensive type guard in copyProjectedEnvelope, unreachable through the public API. Tests: 1487 files before → 1487 after (no new test files; 14 cases added to 3 existing files). Pre-Landing Review No issues found. Notable verifications rather than assumptions: Concurrency: the diff introduces Promise.all over two projections sharing one store. createProjectionContext builds a fresh context per call and all mutable state is per-context; store is read-only config. No race. Enum completeness: LOG_DISPLAY_CONTENT_KEYS was split into two tuples - proved the union is the identical 8-key set, the constant is module-private with one consumer, and neither synthetic span id has an external consumer or leaks into displayData.traceSpans. Adversarial Review Codex found three real issues that three of my own review passes missed. All fixed and re-verified (GATE: PASS): [P1] Nested workflow/custom_block runs receive workflowInput from the parent's resolved block outputs (workflow-handler.ts:578), so the "pre-resolution" premise is false for them. → FIXED: nested trigger types keep workflowInput gated. [P2] buildApiOrInputOutput:477 writes an object input as {...input, input: {...input}}, so the nested `input` is a clone of its siblings and the ORIGINAL workflowInput was the flat object. Narrowing that to { input } displays a shape the run never received. → FIXED: narrow only when the nested value is not a sibling clone. [High] The legacy recovery heuristic can match a non-trigger block — block-executor.ts:833 writes a HITL resume placeholder with the identical executed:false / executionTime:0 / output shape. → FIXED: recovery refuses when more than one candidate matches. [Medium] cloneTraceSpanForProjection is a shallow spread — it bounds span structure, not payload size. TSDoc called it a "bounded clone". → FIXED: documentation corrected to state exactly what it bounds. Design Review No frontend files changed - design review skipped. (gstack-diff-scope reports SCOPE_FRONTEND=true, but that is a false positive from the repo shape; all 6 changed files are apps/sim/lib/**/*.ts.) Eval Results No prompt-related files changed - evals skipped. Scope Drift Scope Check: CLEAN. Intent was to restore workflow input/output on the logs read path; delivered exactly that in 4 source files (1 new) plus 3 test files. No write-path, schema, or API-contract changes. Plan Completion 13 DONE, 3 CHANGED, 0 NOT DONE, 0 UNVERIFIABLE. The 3 CHANGED items are all narrowings made during implementation, each with evidence: Plan proposed exempting finalOutput alongside workflowInput; it now fails closed instead. Plan's Part B proposed fixing a provenance "attachment gap" and webhook monotonicity. Investigation showed neither exists: every terminal path funnels through completeExecutionWithFinalization, which stamps, and onEnvironmentSnapshot fires unconditionally. Verified empirically (108 legacy blobs with the key absent, 5 current-code blobs with it present, no overlap) and pinned with a logging-session test rather than a production change. Verification Results Verified end to end against a live instance (Next.js + realtime + Postgres), using a second server running staging against the same database as an A/B baseline. Blast radius, measured: diffed every display key for 137 executions across both servers. 65 byte-identical, 72 differ only on workflowInput, 0 differ on any other key, 0 lost input. Real legacy data: 108 pre-#6000 runs, all provenance-absent. Zoho Desk webhook runs go from blank to rendering the full payload; baseline stays blank with identical structural trace spans. Forensic shapes: seeded fixtures for the three real blob shapes. Slack envelope keeps 12 keys with token dropped and the value absent from the whole response; nested .input narrows with all 8 hoisted siblings gone; byte-identical shape renders verbatim. Fail-closed: a complete:false run renders input while withholding finalOutput, blockInput, and span content. Regression: a fresh complete-provenance run is byte-identical between the two servers. Functional reader: re-ran a workflow with inputFromExecutionId pointing at a legacy row with no top-level input; it went through the moved extractor and inherited the payload exactly. Known limitations Failed and cancelled runs still show no input. That is a separate, pre-existing write-side bug: completeExecutionWithFinalization accepts workflowInput, and the completed and paused callers pass it, but force_failed, cancelled, and the fallback do not - so those runs persist no input at all and no read-path change can recover it. 42 such runs in the environment I tested. Deliberately left for a separate PR to keep this one read-path only. workflowInput: {} renders as an empty panel for runs that genuinely had no input (a manual run of a workflow whose Start block has no configured input fields). This matches pre-#6000 behavior and is intentional. Test plan Full suite: 18512 passing / 1367 files tsc --noEmit clean, biome check clean check:api-validation, check:boundaries, check:client-boundary, check:utils all pass E2E verified against a live instance with an A/B baseline (see Verification Results) Two tests fail only under full-suite parallel load and pass in isolation - markdown-parse (a 400-seed property test with a 30s ceiling that takes ~10s idle and >45s loaded) and diff-engine. Both are in files this PR does not touch and were failing on staging before it. 🤖 Generated with Claude Code https://claude.ai/code/session_015BdMTqfpyGk33ExErtiPkZ
Open Graph Description: Summary Workflow Input JSON renders empty on the logs page for a large class of executions. This restores it on the read path. Root cause. PR #6000 added a resolved-secret gate to the log display p...
X Description: Summary Workflow Input JSON renders empty on the logs page for a large class of executions. This restores it on the read path. Root cause. PR #6000 added a resolved-secret gate to the log display p...
Opengraph URL: https://github.com/simstudioai/sim/pull/6278
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:92516439-4507-33aa-6249-b82a3039be2b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B076:2E7BAB:6CDDA2:967133:6AFB43A7 |
| html-safe-nonce | 43b2698eda35b49a10195ad200da033f696d51038b1a5f356f65e8128c51b55c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDc2OjJFN0JBQjo2Q0REQTI6OTY3MTMzOjZBRkI0M0E3IiwidmlzaXRvcl9pZCI6IjMzMDQ4MTA0OTM3NjcyNzEzMzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e2ffada486b27b0fe434dc3f30e2bfc5ff742ac17c46c5f55a8833c3750cb2dc |
| hovercard-subject-tag | pull_request:4208783919 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6278/files |
| twitter:image | https://avatars.githubusercontent.com/u/129460234?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/129460234?s=400&v=4 |
| og:image:alt | Summary Workflow Input JSON renders empty on the logs page for a large class of executions. This restores it on the read path. Root cause. PR #6000 added a resolved-secret gate to the log display p... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | d849b928f455c800985398e7f1b659425adb312a5fa14fba5d9a14e62e9fe5dd |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a6c2f87cbcb6414452377b4967858ed6a66f1109 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width