Skip to content

fix(agent): harden macos es/ne scaffolding and supervision#179

Closed
bb-connor wants to merge 1 commit into
mainfrom
nono/phase1-foundation
Closed

fix(agent): harden macos es/ne scaffolding and supervision#179
bb-connor wants to merge 1 commit into
mainfrom
nono/phase1-foundation

Conversation

@bb-connor
Copy link
Copy Markdown
Collaborator

@bb-connor bb-connor commented Mar 8, 2026

Summary

  • harden macOS ES/NE scaffolding so status, receipts, and release packaging fail closed instead of reporting false healthy or supervised success
  • add macOS host status collection plus native ES/NE status helpers, fixtures, and tests under the agent app system-extension scaffolding
  • replace repo-driven swarm shell execution with validated bootstrap presets and safer lane/worktree/branch handling

Testing

  • cargo test -p clawdstrike sandbox:: -- --nocapture
  • cargo test -p hush-cli --test supervisor_tests -- --nocapture
  • cargo test -p hush-cli hush_run::tests -- --nocapture
  • cargo test --manifest-path apps/agent/src-tauri/Cargo.toml macos:: -- --nocapture
  • cargo test --manifest-path apps/agent/src-tauri/Cargo.toml agent_health_route_reports_pending_host_state -- --nocapture
  • cargo clippy -p clawdstrike --tests -- -D warnings
  • cargo clippy -p hush-cli --tests -- -D warnings
  • cargo clippy --manifest-path apps/agent/src-tauri/Cargo.toml --tests -- -D warnings
  • swift test --package-path apps/agent/src-tauri/macos/system-extension/endpoint-security
  • swift test --package-path apps/agent/src-tauri/macos/system-extension/network-extension
  • swift run --package-path apps/agent/src-tauri/macos/system-extension/endpoint-security endpoint-security-status-tool live
  • swift run --package-path apps/agent/src-tauri/macos/system-extension/network-extension network-extension-status-tool live
  • CLAWDSTRIKE_VALIDATE_MACOS_PACKAGING=1 CLAWDSTRIKE_REQUIRE_CONCRETE_MACOS_PACKAGING=1 cargo check --manifest-path apps/agent/src-tauri/Cargo.toml
  • bash -n scripts/notarize-agent-macos.sh scripts/codex-swarm/common.sh scripts/codex-swarm/setup-worktrees.sh
  • git diff --check -- .codex/swarm/lanes.tsv .codex/swarm/waves.tsv .github/workflows/ci.yml .github/workflows/release.yml apps/agent/src-tauri/build.rs apps/agent/src-tauri/src/api_server.rs apps/agent/src-tauri/src/main.rs apps/agent/src-tauri/src/macos/collector.rs apps/agent/src-tauri/src/macos/host.rs apps/agent/src-tauri/src/macos/mod.rs apps/agent/src-tauri/src/macos/status.rs apps/agent/src-tauri/tauri.conf.json crates/libs/clawdstrike/src/sandbox/attestation.rs crates/libs/clawdstrike/src/sandbox/capability_builder.rs crates/services/hush-cli/src/hush_run.rs crates/services/hush-cli/src/supervised_exec.rs crates/services/hush-cli/tests/supervisor_tests.rs docs/plans/multi-agent/codex-swarm-playbook.md docs/plans/threat-intel/overview.md scripts/codex-swarm/common.sh scripts/codex-swarm/setup-worktrees.sh scripts/notarize-agent-macos.sh

Note

Medium Risk
Touches security-adjacent areas (sandbox attestation/receipt semantics) and modifies macOS packaging/release workflows, which could block releases or change reported health if the new validation/status tooling misbehaves.

Overview
Adds macOS EndpointSecurity/NetworkExtension scaffolding under apps/agent/src-tauri/macos/system-extension (Swift packages, status tools, fixtures/tests, and packaging entitlements/plist templates) and wires a new MacosHostService + periodic collector into the agent to surface combined host status in /api/v1/agent/health and local heartbeat payloads.

Hardens build/release gating for macOS packaging: build.rs validates required assets + tauri.conf.json entries (optionally fails release builds if placeholders/scaffold markers remain), CI and release workflows add checks and switch DMG build to a notarization script with required signing/notary env.

Extends sandbox/receipt attestation to include provider-level states, degraded enforcement semantics, and additional counters/hints; updates hush-cli supervised execution to fail closed on non-Linux (marking supervised runs as degraded with an explicit failure) and adjusts tests accordingly.

Written by Cursor Bugbot for commit c52c469. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

case latencyMs = "latency_ms"
case deadlineMs = "deadline_ms"
case notifyObserved = "notify_observed"
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AuthorizationEvent excludes observedAt from CodingKeys

Medium Severity

The AuthorizationEvent struct declares an observedAt: Date? property but the CodingKeys enum does not include a corresponding case for it. This means observedAt is silently excluded from JSON encoding and decoding. While the exceededDeadline computed property still works at runtime, any serialized AuthorizationEvent will lose the observedAt value, making it impossible to reconstruct timestamps from JSON fixtures or status tool output.

Fix in Cursor Fix in Web

} else {
EnforcementLevel::Kernel
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supervised mode always reports degraded on macOS

Medium Severity

effective_enforcement_level always returns Degraded on macOS even for a fully successful supervised_mode(true, true, None) call, because default_provider_states unconditionally adds ProviderState::unknown(...) entries for endpoint_security and network_extension with active: false and healthy: false. The has_degraded_provider check in effective_enforcement_level fires on these, preventing the code from ever reaching the KernelSupervised return path on macOS. This means receipts for legitimate supervised sandbox runs on macOS always claim degraded enforcement, which may cause downstream trust/verification logic to treat valid runs as untrusted.

Additional Locations (1)

Fix in Cursor Fix in Web

@bb-connor
Copy link
Copy Markdown
Collaborator Author

Superseded by #180 after moving the work to fix/macos-es-ne-hardening.

@bb-connor bb-connor closed this Mar 8, 2026
@bb-connor bb-connor deleted the nono/phase1-foundation branch March 8, 2026 19:28
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c52c469b75

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


Ok(Json(AgentHealthResponse {
status: "ok",
status: macos_host_health_status(&macos_host),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep non-macOS agent health from being stuck pending

This now sets top-level health to macos_host_health_status(...), but on non-macOS builds start_status_collector is a no-op (apps/agent/src-tauri/src/macos/mod.rs), so MacosHostService stays at its default unknown state and /api/v1/agent/health reports "pending" indefinitely even when daemon/session are healthy. That makes readiness/monitoring checks fail on Linux/Windows; the top-level status should be gated to macOS-only host checks (or remain "ok" off macOS).

Useful? React with 👍 / 👎.

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.

1 participant