freebuff 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/launcher.js +60 -9
  2. package/package.json +9 -9
package/launcher.js CHANGED
@@ -257,6 +257,39 @@ function createLauncher(productConfig) {
257
257
  )
258
258
  }
259
259
 
260
+ /**
261
+ * Bun's own crash report saying this CPU cannot run the optimized build.
262
+ *
263
+ * On Windows the exit code does not carry that. Bun's crash handler catches
264
+ * EXCEPTION_ILLEGAL_INSTRUCTION itself, prints a report, then leaves through
265
+ * Zig's std.posix.abort(), which on Windows is ExitProcess(3). So an AVX2
266
+ * build on a CPU without AVX2 exits with plain code 3, neither
267
+ * 0xC000001D nor 0xC0000409, and both checks above miss it. The Sept 27
268
+ * report (i3-2100, Bun 1.3.14) is exactly this:
269
+ *
270
+ * CPU: sse42 avx
271
+ * Features: no_avx2
272
+ * panic: Illegal instruction at address 0x7FF61902F82C
273
+ * panicked during a panic. Aborting.
274
+ *
275
+ * The report is in the stderr tail watchLaunch() keeps on Windows. Either line
276
+ * is proof, not a guess. `Features: no_avx2` is Bun's own CPUID answer, and a
277
+ * Bun "Illegal instruction" panic is the same Windows exception
278
+ * 0xC000001D reports, intercepted before it became the exit code. Only Bun's
279
+ * exact formats count, so ordinary output that mentions them does not.
280
+ */
281
+ const BUN_NO_AVX2_FEATURE = /^Features:[^\n]*\bno_avx2\b/m
282
+ const BUN_ILLEGAL_INSTRUCTION_PANIC =
283
+ /^panic(?:\([^)\n]*\))?: Illegal instruction at address 0x[0-9a-f]+/im
284
+
285
+ function stderrReportsMissingCpuFeature(code, signal, stderrTail) {
286
+ if (!stderrTail || (code === 0 && !signal)) return false
287
+ const text = sanitizeForReplay(stderrTail)
288
+ return (
289
+ BUN_NO_AVX2_FEATURE.test(text) || BUN_ILLEGAL_INSTRUCTION_PANIC.test(text)
290
+ )
291
+ }
292
+
260
293
  function createConfig(packageName) {
261
294
  const homeDir = os.homedir()
262
295
  const configDir =
@@ -1406,7 +1439,9 @@ function createLauncher(productConfig) {
1406
1439
  const { msAlive = null, stderrTail = '' } = context
1407
1440
  // Windows NTSTATUS codes (unsigned DWORD)
1408
1441
  const unsignedCode = getUnsignedExitCode(code)
1409
- const isIllegalInstruction = isIllegalInstructionExit(code, signal)
1442
+ const isIllegalInstruction =
1443
+ isIllegalInstructionExit(code, signal) ||
1444
+ stderrReportsMissingCpuFeature(code, signal, stderrTail)
1410
1445
  const isAccessViolation =
1411
1446
  signal === 'SIGSEGV' ||
1412
1447
  (process.platform === 'win32' && unsignedCode === 0xc0000005)
@@ -1429,7 +1464,15 @@ function createLauncher(productConfig) {
1429
1464
  )
1430
1465
  console.error('This typically affects CPUs from before 2013.')
1431
1466
  console.error('')
1432
- printBaselineOverrideHint()
1467
+ if (getCurrentMetadata()?.target === getBaselineFallbackTargetKey()) {
1468
+ console.error(
1469
+ 'This is already the older-CPU (baseline) build — please include the',
1470
+ )
1471
+ console.error('output below in your report.')
1472
+ console.error('')
1473
+ } else {
1474
+ printBaselineOverrideHint()
1475
+ }
1433
1476
  } else if (isAccessViolation) {
1434
1477
  console.error('The binary crashed with an access violation.')
1435
1478
  console.error('')
@@ -1664,11 +1707,15 @@ function createLauncher(productConfig) {
1664
1707
  }
1665
1708
  }
1666
1709
 
1667
- async function tryFallbackToBaseline(code, signal, msAlive) {
1668
- // Two spellings of one failure, at two levels of certainty. SIGILL /
1669
- // STATUS_ILLEGAL_INSTRUCTION is proof this CPU cannot run this build; a
1670
- // Windows startup abort is a strong suspicion (see isStartupCpuFeatureCrash).
1671
- const confirmed = isIllegalInstructionExit(code, signal)
1710
+ async function tryFallbackToBaseline(code, signal, msAlive, stderrTail = '') {
1711
+ // Three spellings of one failure, at two levels of certainty. SIGILL /
1712
+ // STATUS_ILLEGAL_INSTRUCTION, or Bun's crash report naming the missing
1713
+ // feature (see stderrReportsMissingCpuFeature), is proof this CPU cannot
1714
+ // run this build; a Windows startup abort is a strong suspicion (see
1715
+ // isStartupCpuFeatureCrash).
1716
+ const confirmed =
1717
+ isIllegalInstructionExit(code, signal) ||
1718
+ stderrReportsMissingCpuFeature(code, signal, stderrTail)
1672
1719
  if (!confirmed && !isStartupCpuFeatureCrash(code, signal, msAlive)) {
1673
1720
  return false
1674
1721
  }
@@ -1741,15 +1788,18 @@ function createLauncher(productConfig) {
1741
1788
  // as a startup crash and trigger a download.
1742
1789
  const msAlive = child.launch ? child.launch.msAlive() : Infinity
1743
1790
 
1791
+ // Any failed exit, not only a native crash code: a Bun crash on Windows
1792
+ // usually exits with plain code 3, and the reason is only in its stderr
1793
+ // (see stderrReportsMissingCpuFeature). Clean exits skip the wait.
1744
1794
  let stderrTail = ''
1745
- if (child.launch && (isWindowsNativeCrashCode(code) || signal)) {
1795
+ if (child.launch && (code !== 0 || signal)) {
1746
1796
  await child.launch.drained()
1747
1797
  stderrTail = child.launch.stderrTail()
1748
1798
  }
1749
1799
 
1750
1800
  if (
1751
1801
  allowBaselineFallback &&
1752
- (await tryFallbackToBaseline(code, signal, msAlive))
1802
+ (await tryFallbackToBaseline(code, signal, msAlive, stderrTail))
1753
1803
  ) {
1754
1804
  return
1755
1805
  }
@@ -1795,6 +1845,7 @@ function createLauncher(productConfig) {
1795
1845
  readCachedAvx2,
1796
1846
  isIllegalInstructionExit,
1797
1847
  isStartupCpuFeatureCrash,
1848
+ stderrReportsMissingCpuFeature,
1798
1849
  tryFallbackToBaseline,
1799
1850
  printCrashDiagnostics,
1800
1851
  checkForUpdates,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freebuff",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "The world's strongest free coding agent",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -41,13 +41,13 @@
41
41
  "provenance": false
42
42
  },
43
43
  "binaryChecksums": {
44
- "linux-x64": "d23432f34ecbd4f14cbeb1e7f370bad058a03e30f0f65cbca431405cc6bb05ad",
45
- "linux-x64-baseline": "5ce3b598e49f500db1aa8577656600e8e6bc17a938b104290e47a23e5d605bca",
46
- "linux-arm64": "e697880ee488b5e6707f6d7dd65f60c03d14db65c455146d29c5c5ee62042b3a",
47
- "darwin-x64": "93557a697af5a9956e409f02937e4e247e93341754669f3d3dd1af85b42f18cb",
48
- "darwin-x64-baseline": "bd6b48ddfb5e4305855b87248eed25b9d0727d2cbea705cc5cc52b03494bd815",
49
- "darwin-arm64": "be1af482d5c96e0b28a54bb76936755c3928939251d31aa3fca55409353a3144",
50
- "win32-x64": "d7ce3ff20dab76f558a5f65d8f8f7a7c2b78b9f5e45f35889ef98ce86589afbd",
51
- "win32-x64-baseline": "18f9ce899d9e5d9ec1cb58445340e440db074ef7a8a0ae96fd1e58c0aea044a8"
44
+ "linux-x64": "2a149ec595d8f27ec8654b5ab072c22020d5e4f4bd0a0d2c0a1a334b6a063f71",
45
+ "linux-x64-baseline": "22b13efa9eb52d9a074ed2e67feb6474a551796e22d0fa0e7a9a3081943ef16b",
46
+ "linux-arm64": "ef43f44264cae55d86f5d0df45f4c948543d0bf92525c1b296b910badc2f0c71",
47
+ "darwin-x64": "cba39ca908625a8b43335942879fa6c9bd91a2a623f4a26d8a9e0d3e39b080e3",
48
+ "darwin-x64-baseline": "8be9ca67c635dd4bac21d1e726353c24df5d421d598a2c94fff43540a8062369",
49
+ "darwin-arm64": "529b4b2352690c9d3cfc8436e8b15649bc043eb58e07781d6986c6f0f2577f4e",
50
+ "win32-x64": "fc97aa41e2a59304afa49e27bb2f22aa8d7b47f39d182a3abd99c5ca33c5ddd2",
51
+ "win32-x64-baseline": "d280003c00ce1d91b19cbeee3ead6fee516f9aba665c175a8e19553d0a6dfe8c"
52
52
  }
53
53
  }