Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/nullrun/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,16 @@ def _safe_args(fn: Callable[..., Any], args: tuple[Any, ...]) -> list[Any]:
# repr(value) of an arbitrary object.
return [_safe_repr(a) for a in args]

# `bound_params` is sliced to at most `len(args)`, so when the
# function has FEWER positional parameters than args provided
# (e.g. `*args`-style callables), `bound_params` is shorter
# than `args` and the trailing loop below handles the excess.
# We use `strict=False` to make that tolerance explicit and
# satisfy B905; without it the two iterables must be exactly
# the same length, which they are not in the *args case.
bound_params = list(sig.parameters.items())[: len(args)]
masked: list[Any] = []
for (pname, _param), value in zip(bound_params, args):
for (pname, _param), value in zip(bound_params, args, strict=False):
if pname.lower() in SENSITIVE_ARG_KEYS:
masked.append("***")
else:
Expand Down
4 changes: 2 additions & 2 deletions src/nullrun/instrumentation/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import hashlib
import json
import logging
import os
import threading
from collections import OrderedDict
from collections.abc import Callable
Expand Down Expand Up @@ -1143,10 +1144,9 @@ def reset_for_tests() -> None:
# Env-var override: NULLRUN_MAX_RESPONSE_BYTES. None disables the cap
# (escape hatch for users who really need full-body inspection and
# can tolerate the memory cost).
import os as _os
_DEFAULT_MAX_RESPONSE_BYTES = 16 * 1024 * 1024 # 16 MiB
MAX_RESPONSE_BYTES = int(
_os.environ.get("NULLRUN_MAX_RESPONSE_BYTES", _DEFAULT_MAX_RESPONSE_BYTES)
os.environ.get("NULLRUN_MAX_RESPONSE_BYTES", _DEFAULT_MAX_RESPONSE_BYTES)
) or _DEFAULT_MAX_RESPONSE_BYTES


Expand Down
13 changes: 9 additions & 4 deletions src/nullrun/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import logging
import os
import random
import tempfile
import threading
import time
import uuid
Expand Down Expand Up @@ -622,14 +623,18 @@ def _wal_path(self) -> str:

Honours ``NULLRUN_WAL_PATH`` so crash-recovery lands on a
writable mount in containers with
``readOnlyRootFilesystem: true``. Default
``/tmp/nullrun.wal`` matches the convention other agents
use for ephemeral crash-recovery state.
``readOnlyRootFilesystem: true``. Default lands in the
platform temp dir (``tempfile.gettempdir()`` — typically
``/tmp`` on Linux, ``/var/folders/...`` on macOS,
``%TEMP%`` on Windows). Using the platform helper rather
than a hardcoded ``/tmp`` keeps us off S108's insecure
path list and lets the SDK work on Windows out of the
box.
"""
env_path = os.environ.get("NULLRUN_WAL_PATH")
if env_path:
return env_path
return os.path.join("/tmp", "nullrun.wal")
return os.path.join(tempfile.gettempdir(), "nullrun.wal")

def _rotate_wal_if_needed(self) -> None:
"""Rotate ``<path>`` to ``<path>.1`` if it exceeds the size cap."""
Expand Down
Loading