Skip to content

Commit 434c80f

Browse files
committed
Merge branch 'release/1.4' of github.com:NVIDIA/NeMo-Agent-Toolkit into epic/nemo-agent-safety-security-engine
2 parents 16c3f77 + 5690ec4 commit 434c80f

File tree

6 files changed

+23
-30
lines changed

6 files changed

+23
-30
lines changed

src/nat/cli/commands/evaluate.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,19 @@ def process_nat_eval(
195195
"have a partially completed dataset.")
196196

197197
# Create the configuration object
198-
config = EvaluationRunConfig(
199-
config_file=config_file,
200-
dataset=str(dataset) if dataset else None,
201-
result_json_path=result_json_path,
202-
skip_workflow=skip_workflow,
203-
skip_completed_entries=skip_completed_entries,
204-
endpoint=endpoint,
205-
endpoint_timeout=endpoint_timeout,
206-
reps=reps,
207-
override=override,
208-
user_id=user_id,
209-
)
198+
# Only include user_id if explicitly provided via CLI, otherwise use the default
199+
config_kwargs = {
200+
"config_file": config_file,
201+
"dataset": str(dataset) if dataset else None,
202+
"result_json_path": result_json_path,
203+
"skip_workflow": skip_workflow,
204+
"skip_completed_entries": skip_completed_entries,
205+
"endpoint": endpoint,
206+
"endpoint_timeout": endpoint_timeout,
207+
"reps": reps,
208+
"override": override,
209+
}
210+
if user_id is not None:
211+
config_kwargs["user_id"] = user_id
212+
config = EvaluationRunConfig(**config_kwargs)
210213
asyncio.run(run_and_evaluate(config))

src/nat/data_models/config.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,6 @@ class GeneralConfig(BaseModel):
215215

216216
telemetry: TelemetryConfig = TelemetryConfig()
217217

218-
default_user_id: str = Field(
219-
default="default_user_id",
220-
description="Default user ID for per-user workflows when "
221-
"no session is available (for example, when using 'nat run'). This value identifies "
222-
"the workflow instances. For multi-user deployments with 'nat serve', the 'nat-session' "
223-
"cookie overrides this value. Must be a non-empty string when used as a fallback user ID.")
224218
per_user_workflow_timeout: timedelta = Field(
225219
default=timedelta(minutes=30),
226220
description="Time after which inactive per-user workflows are cleaned up. "

src/nat/eval/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class EvaluationRunConfig(BaseModel):
4646
num_passes: int = 0
4747
# timeout for waiting for trace export tasks to complete
4848
export_timeout: float = 60.0
49-
# User ID to use for workflow session
50-
user_id: str | None = None
49+
# User ID to use for workflow session. Defaults to 'nat_eval_user_id'.
50+
user_id: str = "nat_eval_user_id"
5151

5252

5353
class EvaluationRunOutput(BaseModel):

src/nat/front_ends/console/console_front_end_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ class ConsoleFrontEndConfig(FrontEndBaseConfig, name="console"):
3030
description="A single input to submit the the workflow.")
3131
input_file: Path | None = Field(default=None,
3232
description="Path to a json file of inputs to submit to the workflow.")
33-
user_id: str | None = Field(default=None, description="User ID to use for the workflow session.")
33+
user_id: str = Field(default="nat_run_user_id",
34+
description="User ID to use for the workflow session. "
35+
"Defaults to 'nat_run_user_id' for single-user CLI execution.")

src/nat/runtime/session.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -438,17 +438,12 @@ async def session(self,
438438
builder_info: PerUserBuilderInfo | None = None
439439

440440
if self._is_workflow_per_user:
441-
# Resolve user_id: explicit param > context > default
441+
# Resolve user_id: explicit param > context
442442
if user_id is None:
443443
user_id = self._get_user_id_from_context()
444-
if user_id is None:
445-
user_id = self._config.general.default_user_id
446-
if user_id:
447-
logger.info(f"Using default_user_id='{user_id}' for per-user workflow")
448444
if user_id is None:
449445
raise ValueError("user_id is required for per-user workflow but could not be determined. "
450-
"Ensure 'nat-session' cookie is set, pass user_id explicitly, or set "
451-
"'general.default_user_id' in config.")
446+
"Ensure 'nat-session' cookie is set or pass user_id explicitly.")
452447

453448
# Get or create per-user builder
454449
logger.debug(f"Getting or creating per-user builder for user {user_id}")

tests/nat/runtime/test_session_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ def create_mock_config(is_per_user: bool = False) -> Config:
116116
config.general = MagicMock(spec=GeneralConfig)
117117
config.general.per_user_workflow_timeout = timedelta(minutes=30)
118118
config.general.per_user_workflow_cleanup_interval = timedelta(minutes=5)
119-
config.general.default_user_id = None
120119
config.workflow = MagicMock()
121120
return config
122121

@@ -361,7 +360,7 @@ async def test_session_per_user_requires_user_id(self, mock_registry):
361360
entry_function=None,
362361
shared_workflow=None)
363362

364-
with pytest.raises(ValueError, match="user_id is required for per-user workflow"):
363+
with pytest.raises(ValueError, match="user_id is required for per-user workflow but could not be determined"):
365364
async with sm.session():
366365
pass
367366

0 commit comments

Comments
 (0)