Skip to content

fix: phase 3 medium findings (token estimate, seatbelt, pool errors) - #168

Merged
Patel230 merged 3 commits into
mainfrom
feat/phase3-mediums
Aug 2, 2026
Merged

fix: phase 3 medium findings (token estimate, seatbelt, pool errors)#168
Patel230 merged 3 commits into
mainfrom
feat/phase3-mediums

Conversation

@Patel230

@Patel230 Patel230 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Three Phase 3 medium findings from the deep audit, all hawk-internal:

  1. Token estimateestimateTokens in selective_rag.go used len(text)/4, which systematically undercounts code-heavy text and drives compaction decisions. Now uses the BPE-based token.CountTokensFast (tok tokenizer) that the streaming path already uses.
  2. Seatbelt mach-lookup — the macOS seatbelt profile emitted an unconditional (allow mach-lookup) (every XPC service). Non-TierOff tiers now use a minimal service allowlist (opendirectoryd, notification center, cfprefsd, logger; plus DNS/network-config services only when network is allowed). TierOff keeps legacy behavior.
  3. Pool.Run silent failuresparallel.Pool.Run always returned nil even when every task failed. It now returns errors.Join of all failed tasks (task description + error); tasks that fail still don't block others. CLI caller (cmd/chat_commands.go) already renders per-pane failure state and now also receives the aggregate error.

Changes

  • internal/engine/selective_rag.goestimateTokenstoken.CountTokensFast
  • internal/engine/conversation_adapter_test.go — drop len/4 formula assertion; sanity-range check instead
  • internal/sandbox/seatbelt.go — tiered mach-lookup scoping
  • internal/sandbox/seatbelt_test.go — new TestGenerateSeatbeltProfile_MachLookupTiered
  • internal/multiagent/parallel/parallel.go — aggregate failure error from Run
  • internal/multiagent/parallel/parallel_test.go — updated TestErrorHandling, TestContextCancellation

Testing

  • go test -race ./... — all packages pass
  • golangci-lint — 0 issues; gofmt clean
  • GitNexus detect_changes: expected symbols only, no affected execution flows

Out of scope (live in external/ repos, separate PRs): inline tool-call parser (eyrie), PostHog telemetry (trace repo).

@Patel230
Patel230 merged commit fbfe836 into main Aug 2, 2026
23 checks passed
@Patel230
Patel230 deleted the feat/phase3-mediums branch August 2, 2026 18:25
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