Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesstack72

Relationships

#2904 Extension content extractor truncates metadata when a string, comment or regex contains an unpaired brace

Opened by stack72 · 10/1/2026· Shipped 10/2/2026

Summary

src/domain/extensions/extension_content_extractor.ts finds block bodies with extractBalancedBraces, which counts every { and } in the source, including ones inside string literals, template literals, comments and regex literals. One unpaired brace in such a literal ends or extends a block early, so swamp extension push sends incomplete contentMetadata. The server accepts it because it validates, so the registry listing is silently wrong.

Reproduction

A model whose first method's execute contains any of:

  • log("{") or log('}')
  • // a lone } or /* { */
  • const re = /\\{/; or /[{]/g

lists only the first method; every later method and the top-level resources are lost.

Seen in the wild

In swamp-extensions, model/aws/wellarchitected/extensions/models/agent_goal.ts and model/gcp/apigee/extensions/models/apiproducts_rateplans.ts have pattern strings containing \\$\\{. The extractor reports 0 of 9 and 10 of 23 global arguments for them.

Suggested fix

Skip string, template (with ${...} re-entering code), comment and regex literals while counting braces. swamp-club#2890 fixes the server fallback extractor this way, including a guard that keeps the regex heuristic linear on hostile input. Port the scanner (findClosingBrace / skipNonCode in lib/app/extract-extension-content.ts) and its tests.

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 13 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

10/2/2026, 6:39:20 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack7210/2/2026, 5:43:02 PM

Sign in to post a ripple.