feat: Phase 1 advisory leases and structured safety evaluator#144
Conversation
- Add triangle_request_lease / release / heartbeat MCP tools (internal/mcp/triangle.go) - Exclusive 500ms flock-based ledger locking with ctx propagation (reservation/persist.go + ledger.go) - Daemon refresh now loads reservation ledger (internal/daemon/daemon.go) - Snapshot staleness + duration > 0 guards + auto-ID collision note - Hygiene cleanups (8 unused param warnings removed) - Design docs: docs-evaluation.md + future/triangle-orchestration.md + hybrid-orchestration-spec + annotated variant
There was a problem hiding this comment.
Code Review
This pull request introduces the 'Triangle' multi-agent orchestration substrate, adding advisory resource lease tools (triangle_request_lease, triangle_release_lease, triangle_heartbeat_lease) to the MCP server and integrating cross-process file locking in the reservation ledger. It also wires the structured safety evaluator into the execution blocker and removes obsolete compile-gated stubs. Feedback on these changes suggests making the lease duration parameter truly optional by applying a default value, and optimizing the safety check path by reusing a package-level evaluator instance instead of recreating it on every call.
- Remove //go:build safety_scaffolded tag from structured.go - Delete structured_default.go compile-gating stubs - Unify safety.Check by delegating VerdictDeny commands to the structured evaluator - Add TestCheckDelegatesToStructuredEvaluator test to blocker_test.go - Optimize safety evaluator by reusing package-level defaultEvaluator (review feedback) - Make lease duration optional with 120s default (review feedback) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
16ef917 to
a90438d
Compare
|
I have addressed the review feedback and updated the PR:
All local quality checks pass. Pushed updates to trigger CI validation. |
This PR unifies the Phase 1 advisory resource leases (Triangle spec) and the structured safety evaluator into a single robust security layer.
Changes Implemented
Advisory Resource Leases (Triangle):
triangle_request_lease,triangle_release_lease, andtriangle_heartbeat_leaseMCP tools.syscall.Flockexclusive file locking on~/.axis/ledger.json.lockininternal/reservation/persist.gowith a 500ms timeout retry loop to ensure concurrency safety.context.Context) through the locking path to ensure retries are gracefully cancellable.lease-<UnixNano>) and enforcedduration_seconds > 0.internal/daemon/daemon.go.Structured Safety Evaluator:
structured_default.goand removing the//go:build safety_scaffoldedtag fromstructured.go.VerdictDenycommands insafety.Check(blocker.go) directly to the structured ruleset, preserving existing cluster-resource fallbacks.TestCheckDelegatesToStructuredEvaluatorinblocker_test.goand importedstrings.Hygiene & Documentation:
mcp_client.go,explain.go, andtriangle.go.docs-evaluation.md,future/triangle-orchestration.md, and the hybrid spec.Verification Results
go test ./...-> PASS).sudo rm -rf) and prompted commands behave correctly under the unified gate.