feat(host-agent): start local console by default
Tests / Test passed: 662

This commit is contained in:
2026-07-14 07:31:31 +08:00
parent a166ffd8a4
commit 8b7e5a2800
10 changed files with 101 additions and 152 deletions
@@ -1,15 +1,11 @@
## ADDED Requirements
### Requirement: The local console is disabled by default and loopback-bound when enabled
The Host Agent SHALL NOT start any local web console listener unless explicitly enabled by configuration, and SHALL bind that listener to a loopback address unless a separate, explicit configuration setting authorizes a non-loopback bind address.
### Requirement: The local console starts with every Host Agent and is loopback-bound by default
The Host Agent SHALL start its local web console listener on every process start and SHALL bind that listener to a loopback address unless a separate, explicit configuration setting authorizes a non-loopback bind address.
#### Scenario: Default configuration starts no console
#### Scenario: Default configuration starts a loopback console
- **WHEN** the Host Agent starts with no console-related configuration set
- **THEN** no local web console listener is started and existing heartbeat/claim behavior is unaffected
#### Scenario: Console enabled with default bind
- **WHEN** the console is enabled without a non-loopback opt-in
- **THEN** the console listener binds only to a loopback address
- **THEN** the local web console listener starts on `127.0.0.1:8765` and existing heartbeat/claim behavior continues alongside it
#### Scenario: Non-loopback bind requested without opt-in
- **WHEN** the console is configured to bind a non-loopback address without the separate non-loopback opt-in setting
@@ -23,7 +19,7 @@ The Host Agent SHALL NOT start any local web console listener unless explicitly
The local web console SHALL authenticate operators against the same local account credential used by the Host Agent's `setup` command, and SHALL NOT introduce a separate credential store.
#### Scenario: No local account exists
- **WHEN** the console is enabled and no local account file is present
- **WHEN** the Console starts and no local account file is present
- **THEN** the console's login page reports that no account exists and directs the operator to run the setup command, without accepting any login attempt
#### Scenario: Valid login
@@ -50,7 +46,7 @@ The console SHALL issue an opaque session token on successful login, SHALL requi
- **THEN** the console rejects the request and makes no change
#### Scenario: Process restart invalidates sessions
- **WHEN** the Host Agent process restarts while the console is enabled
- **WHEN** the Host Agent process restarts while the Console is running
- **THEN** previously issued session tokens are no longer accepted and operators must log in again
### Requirement: Console displays current heartbeat, enrollment, device, and assignment status
@@ -112,7 +108,3 @@ The Host Agent SHALL retain a bounded, local-only history of recent assignment o
#### Scenario: History is bounded
- **WHEN** the number of recorded history entries exceeds the configured retention limit
- **THEN** the oldest entries are pruned so the stored history does not grow unbounded
#### Scenario: History available without console enabled
- **WHEN** the console is disabled
- **THEN** the Host Agent does not record local history and incurs no related overhead