Skip to content

fix: make agent pre_authkey optional when disabled#476

Open
drifterza wants to merge 1 commit intotale:mainfrom
drifterza:fix/issue-455-nixos-agent-config
Open

fix: make agent pre_authkey optional when disabled#476
drifterza wants to merge 1 commit intotale:mainfrom
drifterza:fix/issue-455-nixos-agent-config

Conversation

@drifterza
Copy link
Contributor

Fixes #455

Problem

When using NixOS module with agent disabled, headplane fails to start because pre_authkey is required even when enabled: false.

Solution

Changed the agent config validation to only require pre_authkey when enabled is true. Uses arktype's narrow() for conditional validation.

Changes

  • app/server/config/config-schema.ts - pre_authkey now optional with conditional check
  • tests/unit/config/agent-disabled.test.ts - tests for disabled/enabled scenarios

Testing

  • 4 new tests covering: disabled without key, enabled without key (should fail), enabled with key, no agent config

@tale
Copy link
Owner

tale commented Mar 7, 2026

I'm aware this was most likely written using AI given the unit test, but please remove this test, it is entirely unnecessary for what is a simple 5 line fix.

Edit: Either that or put it into existing config tests that we already have.

When integration.agent.enabled is false, pre_authkey should not be
required. Added conditional validation using arktype's narrow().
@drifterza drifterza force-pushed the fix/issue-455-nixos-agent-config branch from 8f29512 to b0cf5ea Compare March 10, 2026 13:50
@drifterza
Copy link
Contributor Author

Removed the separate test file as requested. The fix is straightforward - the conditional validation using .narrow() follows the same pattern used elsewhere in the codebase.

Changes: 9 lines in app/server/config/config-schema.ts only.

@github-actions github-actions bot added the Config Related to Headplane specific configuration label Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Config Related to Headplane specific configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nixos: even with agent disabled settings.integration.agent.pre_authkey_path needs to be set otherwise headplane won't start

2 participants