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
Analysis Date: 2026-10-09 Focus Area: Concurrency safety & race detection Strategy Type: Custom Custom Area: Yes — prior runs covered errors, contexts, function size and test isolation; concurrency/race coverage is not yet examined.
Executive Summary
The repo has solid concurrency discipline: 37 non-test go statements, all inspected ones recover from panics, and custom linters exist (goroutinemissingrecover, wgdonenotdeferred, timeafterleak, manualmutexunlock). The biggest gap is that no -race run is configured in the Makefile or ci.yml, despite ~4,100 t.Parallel()/RunParallel usages and shared package-level caches.
Secondary items: ~15 package-level sync.Map caches (pkg/cli/update_workflows.go:25-27, pkg/workflow/yaml.go:108, pkg/workflow/behavior_defined_engine.go:806,824) with no documented lifecycle or reset for tests; ~87 package-level maps/sync vars that are safe only by "read-only by convention"; and two time.After uses in select statements (pkg/cli/mcp_inspect.go:139, pkg/cli/mcp_inspect_inspector.go:243).
Full Analysis Report
Current State Assessment
Metric
Value
Status
-race in Makefile/CI
0 occurrences
❌
Non-test go statements
37
✅
Goroutines with recover (sampled)
5/5
✅
Concurrency linters
4 present
✅
Package-level sync.Map caches
~10
⚠️
Non-test time.After
2 (in select)
⚠️
Parallel test markers
~4,111
⚠️ without race detection
Strengths
Panic-recovery and defer wg.Done() enforced by linters.
errgroup and semaphores used for fan-out (audit_analysis_fanout.go, forecast_compute.go).
Areas for Improvement
High: no race detector in any test target.
Medium: global sync.Map caches without invalidation/test-reset helpers.
Low: time.After in mcp_inspect*.go; read-only global maps not enforced (pkg/cli/outcome_eval.go:78, pkg/workflow/safe_outputs_handler_registry_issues.go:4).
🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Add race-detector test target
Priority: High Estimated Effort: Small Focus Area: Concurrency
Description: Add make test-race running go test -race on concurrency-heavy packages (./pkg/cli, ./pkg/console, ./pkg/syncutil, ./pkg/parser) and wire it into CI (scheduled or non-blocking first).
Acceptance Criteria:
make test-race exists and is documented
CI job runs it
Any detected races are listed or fixed
Code Region:Makefile, .github/workflows/ci.yml
Add a `test-race` Makefile target using `go test -race -count=1` for pkg/cli, pkg/console, pkg/syncutil, pkg/parser, pkg/workflow. Add a CI job. Fix or report any races found.
Task 2: Consolidate global sync.Map caches
Priority: Medium Estimated Effort: Medium Focus Area: Concurrency
Description: Replace raw package-level sync.Map caches with typed wrappers (generic cache in pkg/syncutil) that provide typed access and a Reset() for tests.
Add a generic typed cache to pkg/syncutil with Load/Store/Reset and migrate the package-level sync.Map vars listed. Keep behavior identical; run make test-unit.
Task 3: Replace time.After in MCP inspect selects
Priority: Low Estimated Effort: Small Focus Area: Concurrency
Description: Use time.NewTimer + defer Stop() in mcp_inspect.go:139 and mcp_inspect_inspector.go:243, or justify with (nolint/redacted):timeafterleak.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
🎯 Repository Quality Improvement Report - Concurrency Safety & Race Detection
Analysis Date: 2026-10-09
Focus Area: Concurrency safety & race detection
Strategy Type: Custom
Custom Area: Yes — prior runs covered errors, contexts, function size and test isolation; concurrency/race coverage is not yet examined.
Executive Summary
The repo has solid concurrency discipline: 37 non-test
gostatements, all inspected ones recover from panics, and custom linters exist (goroutinemissingrecover,wgdonenotdeferred,timeafterleak,manualmutexunlock). The biggest gap is that no-racerun is configured in theMakefileorci.yml, despite ~4,100t.Parallel()/RunParallelusages and shared package-level caches.Secondary items: ~15 package-level
sync.Mapcaches (pkg/cli/update_workflows.go:25-27,pkg/workflow/yaml.go:108,pkg/workflow/behavior_defined_engine.go:806,824) with no documented lifecycle or reset for tests; ~87 package-level maps/sync vars that are safe only by "read-only by convention"; and twotime.Afteruses in select statements (pkg/cli/mcp_inspect.go:139,pkg/cli/mcp_inspect_inspector.go:243).Full Analysis Report
Current State Assessment
-racein Makefile/CIgostatementssync.Mapcachestime.AfterStrengths
defer wg.Done()enforced by linters.errgroupand semaphores used for fan-out (audit_analysis_fanout.go,forecast_compute.go).Areas for Improvement
sync.Mapcaches without invalidation/test-reset helpers.time.Afterinmcp_inspect*.go; read-only global maps not enforced (pkg/cli/outcome_eval.go:78,pkg/workflow/safe_outputs_handler_registry_issues.go:4).🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Add race-detector test target
Priority: High
Estimated Effort: Small
Focus Area: Concurrency
Description: Add
make test-racerunninggo test -raceon concurrency-heavy packages (./pkg/cli,./pkg/console,./pkg/syncutil,./pkg/parser) and wire it into CI (scheduled or non-blocking first).Acceptance Criteria:
make test-raceexists and is documentedCode Region:
Makefile,.github/workflows/ci.ymlTask 2: Consolidate global sync.Map caches
Priority: Medium
Estimated Effort: Medium
Focus Area: Concurrency
Description: Replace raw package-level
sync.Mapcaches with typed wrappers (generic cache inpkg/syncutil) that provide typed access and aReset()for tests.Acceptance Criteria:
update_workflows.go,yaml.go,behavior_defined_engine.gocaches migratedCode Region:
pkg/cli/update_workflows.go,pkg/workflow/yaml.go,pkg/workflow/behavior_defined_engine.goTask 3: Replace time.After in MCP inspect selects
Priority: Low
Estimated Effort: Small
Focus Area: Concurrency
Description: Use
time.NewTimer+defer Stop()inmcp_inspect.go:139andmcp_inspect_inspector.go:243, or justify with(nolint/redacted):timeafterleak.Acceptance Criteria:
time.Afterin non-test codeCode Region:
pkg/cli/mcp_inspect.go,pkg/cli/mcp_inspect_inspector.goTask 4: Freeze read-only global lookup maps
Priority: Low
Estimated Effort: Medium
Focus Area: Concurrency
Description: Convert package-level lookup maps (e.g.
outcomeEvaluators,issueHandlerRegistry,jsonToolToToolset) to accessor functions orsync.OnceValuebuilders so mutation cannot happen from parallel tests; confirmpackagelevelmutableslicemaplinter covers them.Acceptance Criteria:
Code Region:
pkg/cli/outcome_eval.go,pkg/workflow/safe_outputs_handler_registry_issues.go,pkg/cli/jsonworkflow_to_markdown.go📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
make test-raceand CI job — Priority: HighShort-term Actions (This Month)
Long-term Actions (This Quarter)
📈 Success Metrics
Next Steps
Generated by Repository Quality Improvement Agent
Next analysis: 2026-10-10 — Focus area selected by diversity algorithm
All reactions