fix: phase 3 medium findings (token estimate, seatbelt, pool errors) - #168
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Three Phase 3 medium findings from the deep audit, all hawk-internal:
estimateTokensinselective_rag.gousedlen(text)/4, which systematically undercounts code-heavy text and drives compaction decisions. Now uses the BPE-basedtoken.CountTokensFast(tok tokenizer) that the streaming path already uses.(allow mach-lookup)(every XPC service). Non-TierOfftiers now use a minimal service allowlist (opendirectoryd, notification center, cfprefsd, logger; plus DNS/network-config services only when network is allowed).TierOffkeeps legacy behavior.parallel.Pool.Runalways returnednileven when every task failed. It now returnserrors.Joinof 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.go—estimateTokens→token.CountTokensFastinternal/engine/conversation_adapter_test.go— drop len/4 formula assertion; sanity-range check insteadinternal/sandbox/seatbelt.go— tiered mach-lookup scopinginternal/sandbox/seatbelt_test.go— newTestGenerateSeatbeltProfile_MachLookupTieredinternal/multiagent/parallel/parallel.go— aggregate failure error fromRuninternal/multiagent/parallel/parallel_test.go— updatedTestErrorHandling,TestContextCancellationTesting
go test -race ./...— all packages passgolangci-lint— 0 issues; gofmt cleandetect_changes: expected symbols only, no affected execution flowsOut of scope (live in
external/repos, separate PRs): inline tool-call parser (eyrie), PostHog telemetry (trace repo).