You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Report DSH runtime audit events to AgentGuard Cloud when connected. Failed uploads are persisted to the local event spool and retried on subsequent tool calls, with serialized spool access to prevent duplicate reporting during concurrent executions.
Also clean stale build output before TypeScript compilation and isolate DSH auto-detection in CLI initialization tests.
This patch introduces a couple of concrete regressions in DSH cloud reporting and test setup.
severity: high — src/dsh/runtime.ts (evaluateAndAuditDshAction, new client.ingestEvents([event]) call and spool flush) What can go wrong: Each DSH action now performs synchronous cloud ingestion before returning, and the fallback path can spool the current event plus previously queued events. Because failures are swallowed, repeated ingestion errors can cause the same event to be retried many times across runs, and a partial flush failure can leave the spool in an inconsistent state where some events are lost or duplicated. The code also reports the current event only after audit write, but the earlier flush-before-evaluate step can turn a harmless event-evaluation path into one that depends on network/storage availability. Fix: Make ingestion strictly append-only and idempotent: persist the event locally first, then enqueue async upload with explicit acknowledgements/removal only after successful server response. Keep flushing separated from per-request evaluation, and preserve failed flush state atomically if any upload fails.
severity: medium — src/dsh/runtime.ts (withDshSpoolLock using an in-memory Map<string, Promise<void>>) What can go wrong: The lock only serializes within a single Node process. If multiple processes or workers share the same eventSpoolPath, concurrent flush/spool operations can still race, corrupt the JSONL spool, or lose events. This is especially risky because the file path is configurable and used for security audit data. Fix: Use an actual file lock or atomic rename/write strategy around spool operations, or otherwise guarantee a single writer per spool path across processes.
severity: medium — src/tests/cli-init.test.ts (environment overrides in both init tests) What can go wrong: The tests now force DSH_HOME to a missing directory and DSH_SHELL=0. If CLI init logic relies on those variables being absent or set differently, these tests may no longer exercise the real auto-detection path and can mask regressions in DSH setup behavior. Fix: Scope the overrides to only the specific behavior under test, and add separate coverage for the default environment-detection path to ensure init --agent auto still works when DSH is installed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Report DSH runtime audit events to AgentGuard Cloud when connected. Failed uploads are persisted to the local event spool and retried on subsequent tool calls, with serialized spool access to prevent duplicate reporting during concurrent executions.
Also clean stale build output before TypeScript compilation and isolate DSH auto-detection in CLI initialization tests.
Type
Testing
npm run buildpassesnpm testpasses (32 tests)Related Issues
Closes #