Repository navigation
Conversation
|
Hi! I'm the It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃 |
|
Dependency limit exceeded — report not shown. This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report. Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard. Socket is always free for open source. If this is a public open source project under an OSI-approved license, contact us to request a free Business plan upgrade. |
…ules The agent now connects and configures itself the way N|Solid's gRPC agent does, so a deployment's NSOLID_* settings mean the same for Bun processes. Transport: - NSOLID_GRPC_CERTS replaces the default roots with a CA bundle; one that can't be read leaves the defaults. - NSOLID_GRPC_CLIENT_CERT and NSOLID_GRPC_CLIENT_KEY present a client certificate, read again every NSOLID_GRPC_CLIENT_CERT_REFRESH_INTERVAL seconds (60), so a renewed one is used from the next connection on. Both of N|Solid's warnings are kept word for word. - NSOLID_GRPC_KEYLOG writes ./nsolid-tls-keylog-<pid>.log. - Reconnects back off from 500 ms to 60 s with jitter, and the 20th UNAUTHENTICATED close stops the agent with N|Solid's warning. A stream that stayed up a minute resets both. The Console's retry-after lengthens a delay. - A Command stream that the gateway ends with a status now counts as closed: before, the agent's open half kept it from reconnecting. Config follows lib/nsolid.js: NSOLID_APPNAME before NSOLID_APP, tags of 2 to 140 bytes and at most 20 (with N|Solid's warnings), validated interval, trace sample rate and contCpuProfileInterval, the tracing module blacklist, statsd's localhost shorthand and default bucket, and redactSnapshots/disableSnapshots that stay on once a source turns them on. Reconfigure applies updateConfig's validation. BUN_NSOLID_RETRY_MS_FOR_TESTING fixes the reconnect delay for tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
Metrics. Every `interval` the agent exports N|Solid's process metrics (rusage counts, memory, load, CPU %, uptimes) and each JavaScript thread's heap (heapTotal, heapUsed, externalMem) over OTLP's MetricsService on the gRPC channel, with N|Solid's names, units, scope and resource. The `metrics` command answers with the last periodic sample, as N|Solid's does. A thread's figures are read on that thread: the main thread and each worker register with the agent, which posts each a request through ScriptExecutionContext::postTaskTo. The agent's own VM takes a context id outside the sequence that numbers workers, so worker.threadId is the same with the agent as without it. Exit. The main thread's exit, uncaught exception (message and stack) and SIGINT/SIGTERM/SIGHUP when nothing else handles them are sent as ExportExit; the exiting thread waits for it, 5 seconds at most. A process that is not connected exits at once. Packages. The node_modules scan of N|Solid's genPackageList runs on the agent's thread; a package is `required` once the main thread has loaded a module of it, read from its module registry and require.cache. Packages linked by bun install's isolated linker are listed, with their dependencies found beside them. The nsolid module is N|Solid's: start(config) (which also starts the agent for `grpc` or `saas`), id, config, info, metrics, packages and the config getters. The agent publishes its configuration, so nsolid.config shows what the Console set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
nsolid-bun has a version of its own, 0.1.0, beside Bun's: process.versions.nsolid_bun, `bun --version` prints "1.4.6 (nsolid-bun 0.1.0)", the User-Agent is "Bun/1.4.6 nsolid-bun/0.1.0", and the agent sends nsolid-version "nsolid-bun-v0.1.0+bun-v1.4.6". `bun upgrade` no longer replaces nsolid-bun with oven-sh's Bun (which has no N|Solid agent): it points at nsolid-bun's releases and exits 1. A crash sends no report unless BUN_CRASH_REPORT_URL names where to, and prints its trace string without the bun.report address, asking for it to be included in a report to NodeSource. WebKit: --webkit-mirror=<base URL> downloads the prebuilts from a mirror, still checked against deps/webkit.sha256. nsolid-webkit-mirror.yml copies the pinned release (Linux tarballs and the AoT sources) to a release of this repository; nsolid-bun.yml builds from it once the repository variable NSOLID_WEBKIT_MIRROR is set. The agent's package scan now runs without holding up its thread: on a large node_modules it took seconds, during which no command was acknowledged. nsolid.packages() still scans at once, as N|Solid's does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
The crash test timed out in CI: the runner pipes a crashing process to systemd-coredump, which keeps it alive while it reads bun-profile's memory. The N|Solid test step now writes cores to a plain file and turns them off, as Bun's own CI machines do (ci-images/spec.ts sets kernel.core_pattern to a file). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
- Format: rustfmt over the Phase 1 Rust. - Lint JavaScript: four properties read in an `if` and again in its body are read once into a local. - clippy: the signal module reads and writes its pipes with bun_sys, zeroes structs with bun_core::ffi::zeroed and passes raw pointers with &raw. - mordant (unused_pub): `bun --version` and the crash handler keep upstream's code below an `if Global::NSOLID_BUN` branch, as `bun upgrade` does, so package_json_version_nl and bun_analytics::is_enabled stay in use. Behavior is unchanged: a crash is reported only to BUN_CRASH_REPORT_URL, which upstream already preferred over every other setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
The handler for SIGINT, SIGTERM and SIGHUP waits for the reporter thread to send the exit and acknowledge it, and the report runs on the agent's thread. A signal sent to the process goes to any thread that does not block it, so it could land on either of them: the handler then waited on itself, and the process took 5 seconds (the agent's thread) or 6 (the reporter's) to exit, with no report. It is the likely cause of a CI test whose cleanup ran past the 5-second test timeout. Both threads now start with the three signals blocked, as do the threads the agent's VM starts. The main thread's mask is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
The Lint JavaScript job type-checks src/js after `bun lint`, which failed first until now. Its types give os.userInfo().username and fs.promises.readFile(path, "utf8") as string | Buffer; both are strings here, and are now passed through String(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
…in thread The last commit blocked SIGINT, SIGTERM and SIGHUP on the agent's thread and its signal reporter. That holds for the reporter, but not for the agent: Bun's event loop waits in epoll_pwait2 with an empty signal mask, so the agent's thread takes every signal while it is idle. CI's release build showed it, and another test then ran past its 5-second timeout. The handler now checks where it runs instead. On the agent's thread or the reporter's, the two it waits on, it sends the signal to the main thread with pthread_kill and returns. No thread's mask changes, so the threads the agent starts (Bun's pool among them) no longer inherit blocked signals either. The tests send SIGTERM to each of the two threads with tgkill: the process now reports the signal and exits at once; it used to report nothing and exit after 5 seconds (the agent's thread) or never (the reporter's, with the signal blocked). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
a80f658 to
c098795
Compare
Phase 1 of nsolid-bun, the second PR of the stack:
main)The Console-side Phase 1 work is in the Console repository, in a draft pull request of its own.
Phase 1 items
retry-aftermetricsExportExitwith code, signal and error, sent before the process exits (aborts and crashes are Phase 2)node_modulesscan, loaded packages, bun's isolated linkernsolidmodule, part 1: start, config, id, info, metrics, packages--version, User-Agent,bun upgrade, crash reportsRebased on 2026-12-04 onto
mainat 6cab274, which brings in oven-sh/bun at 39b4945. The commit SHAs in this description are the rebased ones. What the rebase changed here: upstream'sprocess.versionsstatics are byte arrays now, soBun__nsolidBunVersionis one too; and this branch no longer merges Phase 0's lint fix, it sits on top of it, so the stack is linear.What does this PR do?
Transport and config (commit 373a254)
NSOLID_GRPC_CERTSreplaces the default roots with a CA bundle.NSOLID_GRPC_CLIENT_CERTandNSOLID_GRPC_CLIENT_KEYpresent a client certificate, re-read everyNSOLID_GRPC_CLIENT_CERT_REFRESH_INTERVALseconds, with N|Solid's two warnings.NSOLID_GRPC_KEYLOGwrites the TLS secrets to./nsolid-tls-keylog-<pid>.log.retry-afterlengthens a delay.lib/nsolid.js: precedence, tag limits, value validation, sticky snapshot flags.reconfigurevalidates new values.Metrics, thread registry, exit, packages, the
nsolidmodule (commit b775aa0)Metrics:
interval, N|Solid's process metrics and each JavaScript thread's heap (heapTotal, heapUsed, externalMem) go out over OTLP'sMetricsService/Export. They use N|Solid's names, units,nsolidscope and resource attributes.metricsanswers with the last periodic sample, as N|Solid's does.ScriptExecutionContext::postTaskTo.worker.threadIdis the same with the agent as without it.Exit: these are sent as
ExportExit:The exiting thread waits 5 s at most. A process with no Console connection exits at once.
Packages:
genPackageListscan runs on the agent's thread.requiredmeans the main thread loaded a module of the package, read from its module registry andrequire.cache.node_modules/.bunlayout is listed correctly.nsolidmodule: it is N|Solid'sstart(), withid,config,info,metrics,packagesand the config getters on it.start({ grpc })orstart({ saas })starts the agent.nsolid.configshows what the Console set.Branding, WebKit mirror, a scan that doesn't block (commit 30c5190)
process.versions.nsolid_bunis 0.1.0.bun --versionprints1.4.6 (nsolid-bun 0.1.0).Bun/1.4.6 nsolid-bun/0.1.0.nsolid-versionisnsolid-bun-v0.1.0+bun-v1.4.6.bun upgrade: it no longer replaces nsolid-bun with oven-sh's Bun. It points at this repository's releases and exits 1.BUN_CRASH_REPORT_URLnames where to. It prints its trace without a bun.report address and asks for it to be included in a report to NodeSource. WithBUN_CRASH_REPORT_URLset, upstream's reporting runs as before.--webkit-mirror=<base URL>downloads the WebKit prebuilts from a mirror, still checked againstdeps/webkit.sha256.nsolid-webkit-mirror.yml(onmain) copies the pinned release's Linux tarballs and AoT sources to a prerelease of this repository. It has run, and the repository variableNSOLID_WEBKIT_MIRRORis set, sonsolid-bun.ymlbuilds fromgithub.com/nodesource/ns-bun/releases/download.node_modulesit took seconds, during which no command was acknowledged.nsolid.packages()still scans at once, as N|Solid's does.CI, and two fixes it found (commits 12475bc to c098795)
bun_sysfor its pipes.Behavior changes from Phase 0:
bun --versionand the default User-Agent now name nsolid-bun.Bun's own tests that check those strings, or that expect a bun.report link, will differ. This repository's CI runs only the N|Solid tests.
How did you verify your code works?
bun bd test test/js/bun/nsolid/nsolid-agent.test.ts: 27 tests. They cover:metricsandpackagescommands;tgkillto the agent's thread and to the signal reporter's;nsolidmodule with and without an agent;start({ grpc });--version, the User-Agent,bun upgradeand the crash message.With
USE_SYSTEM_BUN=1they fail. All 27 pass on the debug build; when the whole file runs at once there, a few tests can take longer than the 5 s default (the same tests take about 1 s or less in CI's release build).vm-thread-doorinventory updated: the new signal-reporting thread is the second thread spawn innsolid_agent.rs.Against a local N|Solid Console:
requiredflags, and its exit with code 3.--webkit-mirrorchecked by configuring with and without it, and in CI: the build log shows the WebKit tarball fetched from the mirror.CI on 3b3aafd, before the rebase: every check passes, Linux x64 and
cargo miri testincluded.After the rebase: every check passes at c098795,
cargo miri testincluded.https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
Generated by Claude Code