Skip to content

fix: make agent pre_authkey optional when disabled#476

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

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
Copy Markdown
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
Copy Markdown
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.

@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
Copy Markdown
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
@drifterza drifterza force-pushed the fix/issue-455-nixos-agent-config branch from a1d22c6 to 8c1a98d Compare May 3, 2026 20:50
@drifterza
Copy link
Copy Markdown
Contributor Author

Closing this PR since the pre_authkey field has been completely deprecated and removed from being required upstream in . The underlying issue (#455) is safely resolved by that deprecation && gh pr close 476 --repo tale/headplane

@drifterza drifterza closed this May 3, 2026
@drifterza drifterza deleted the fix/issue-455-nixos-agent-config branch May 3, 2026 20:53
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