Skip to content

fix: install and verify AgentGuard in the selected DSH profile - #153

Merged
Mr-Lucky merged 2 commits into
mainfrom
fix/dsh-profile-selection
Nov 11, 2026
Merged

Mr-Lucky merged 2 commits into
mainfrom
fix/dsh-profile-selection

Conversation

@Mr-Lucky

Copy link
Copy Markdown
Contributor

Summary

Install AgentGuard in the selected DSH profile instead of assuming web. Automatically select the sole installed profile, or accept --profile and AGENTGUARD_DSH_PROFILE when a choice is needed. Verify the bundle after installation and report an unverified saved profile in agentguard status. Update the DSH setup documentation.

Type

  • Bug fix
  • New feature / detection rule
  • Refactoring
  • Documentation

Testing

  • npm run build passes
  • npm test passes (full suite)
  • Manually tested the change
  • node --test dist/tests/cli-init.test.js passes (29 tests)

The full suite did not pass: some tests could not bind to 127.0.0.1 in the sandbox, and release checks found 1.2.4 metadata where 1.2.5 is expected.

Related Issues

Closes #

@Mr-Lucky
Mr-Lucky merged commit 7012c45 into main Nov 11, 2026
1 of 4 checks passed
@github-actions

Copy link
Copy Markdown

AgentGuard PR Review

  1. medium — src/cli.ts / src/installers.ts (new status path and isDshProfileBundleInstalled)

    • What can go wrong: agentguard status now marks DSH as unverified if the stored profile manifest is missing or unreadable, but init still writes config.agentHost = 'dsh' before verification only in the happy path. If the DSH manifest later changes, status returns exit code 1 even though AgentGuard may still be installed and functional in DSH. This creates a false-failure regression for existing installations and can break automation that relies on status as a health check.
    • Fix: Treat stale/missing manifest as “installed but not verified” without failing the command, or gate the nonzero exit only on explicit --strict/verification mode. At minimum, distinguish “bundle absent” from “profile unknown” and preserve a non-error status for legacy installs.
  2. medium — src/installers.ts (resolveDshProfile) and src/cli.ts (--profile handling)

    • What can go wrong: The new profile validation rejects any profile name not matching ^[a-zA-Z0-9][a-zA-Z0-9_-]*$. If DSH allows profile names outside this subset, agentguard init --agent dsh will fail for valid profiles, and AGENTGUARD_DSH_PROFILE values from the environment will now be rejected. This can block initialization for legitimate setups.
    • Fix: Validate against DSH’s actual profile naming rules or query DSH for the selected profile rather than imposing a narrower regex. If a regex is retained, document and enforce the same constraints in DSH itself.
  3. low — src/cli.ts / src/tests/cli-init.test.ts (auto-init with profile/env)

    • What can go wrong: In auto mode, dshDetected becomes true whenever AGENTGUARD_DSH_PROFILE is merely defined, even if it is an empty string. That causes DSH initialization to be attempted and can fail with “Invalid DSH profile name” in environments that accidentally export an empty variable, changing behavior from a no-op to a hard error.
    • Fix: Only treat the env var as set when it contains a non-empty trimmed value, or normalize empty strings to undefined before detection/validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants