Skip to content

fix(javascript): report a worker resource constraint once - #3039

Closed
balkan16 wants to merge 1 commit into
morluto:mainfrom
balkan16:fix/javascript-resource-message-prefix
Closed

balkan16 wants to merge 1 commit into
morluto:mainfrom
balkan16:fix/javascript-resource-message-prefix

Conversation

@balkan16

Copy link
Copy Markdown
Contributor

Summary

analyze-javascript-application limitations repeated the resource-constraint prefix for every file the parent declined:

main.js: Resource constraint during analyze_javascript_application: main.js: Resource constraint during analyze_javascript_application: The parent reserved its remaining result capacity for static observations; semantic analysis of main.js was not started

The worker now sends only the constraint reason, so the message is formatted once:

main.js: Resource constraint during analyze_javascript_application: The parent reserved its remaining result capacity for static observations; semantic analysis of main.js was not started

No separate issue: found while running the tool on a real app, and the fix is small and self-contained.

Problem and expected behavior

  • JavaScriptAnalysisWorkerServer.ts serialized cause.message for an AnalysisResourceConstraintError, which is already formatted as Resource constraint during <operation>: <reason>.
  • JavaScriptAnalysisWorker.ts wrapped that text in a second AnalysisResourceConstraintError with a ${file.path}: prefix.
  • JavaScriptArtifactAnalysis.ts, the only consumer, prefixes ${file.path}: again.

Observed on a real Electron app (Postman desktop): every declined file produced the doubled text. Expected: the operation and path appear once.

Change and scope

  • Worker server: send cause.reason for a resource constraint; other failures unchanged.
  • Parent: stop adding the path to the resource reason; the application consumer remains the single owner of the path prefix.

Not included: how the parent allocates the semantic budget across files.

Contribution scope: an ordinary fix within existing boundaries; a maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: worker failure frame (JavaScriptAnalysisWorkerServer.ts)
  • Contribution scope fit and linked maintainer decision: ordinary fix; not applicable
  • CLI and MCP/tool-catalog contract: no schema change; limitation and error text lose the duplicated prefix
  • Provider, bridge, target-format, or platform compatibility: none
  • Evidence, artifact, provenance, or reconstruction contract: reportedLimits and error tags unchanged
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable; worker lifecycle and cleanup unchanged
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts, "formats a real worker's declined semantic budget once". It runs the real owned worker process and declines its semantic budget at the admission frame, as an exhausted parent does, then checks the reason and that the message names the constraint once.
  • Base reproduction or other evidence: executed. Fails on base with the exact doubled text above; passes with the change.
  • User-visible CLI/MCP output: shown in the summary
  • Remaining proof gaps: the Postman observation was on macOS; the fix and test ran on Linux only.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts — 10 passed (1 new)
  • Same file with the source change reverted — the new test fails with the doubled text above, 9 others pass
  • npm run check:fast — pass
  • npm run verify:test-discovery — pass (1181 files)

Compatibility, safety, and release

  • Breaking changes or migration steps: none
  • Real Hopper/Ghidra, browser, or OS coverage: Linux; original observation on macOS
  • Package or release metadata impact: none
  • Security, privacy, process, or containment review: message text only

Before merge

  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q3rXQaLacJ7gNBRkp7DovF

The worker sent its already formatted resource error message, and the
parent wrapped it in a second resource error with another path prefix.
Limitations then read "main.js: Resource constraint during ...: main.js:
Resource constraint during ...: <reason>". The worker now sends only the
reason, and the parent formats the error once; the application consumer
still prefixes the source path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q3rXQaLacJ7gNBRkp7DovF
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T23:55:38.277335Z 0f4bfec PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; it removes duplicate error formatting without changing resource checks.

Summary

The worker sends the plain resource-constraint reason. The parent formats the error once, and the application adds the file path.

  • JavaScript resource-limit messages show the file path and constraint prefix once.

Diagram

sequenceDiagram
  participant Server as Worker server
  participant Parent as Parent worker
  participant App as Application
  Server->>Parent: Failure frame with plain reason and limits
  Parent->>Parent: Format AnalysisResourceConstraintError once
  Parent->>App: Return error and retained facts
  App->>App: Add file path to limitation
Loading

Reviews (1) · Last reviewed commit: "fix(javascript): report a worker resourc..." · Reviewed by Greptile

morluto added a commit that referenced this pull request Oct 14, 2026
Serialize the typed resource reason once and let the application own path formatting, retaining partial static observations and reported limits.

Reviewed-PR: #3039
Co-authored-by: balkan16 <[email protected]>
@morluto

morluto commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Superseded by f2f83934d22e4d375a74dea06677eb77d6958259. The worker now serializes the typed resource-failure reason once and leaves path formatting to the application owner, avoiding duplicated prefixes while retaining partial observations. Validation: tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts (10 tests) passed in the phase-five public log, including the real owned analyzer boundary and cleanup behavior. Thanks to the PR author.

@morluto morluto closed this Oct 14, 2026
@morluto morluto added bug Something isn't working area: domain Domain logic, errors, and pure functions labels Oct 14, 2026
@morluto morluto added the area: runtime Process capture and runtime observation label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants