feat: wire invoke_capability() dispatch, CLI run command, and integration tests#2
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
Production wiring that connects the reasoning loop to real capability implementations and turns the
sentinel runCLI command into a working investigate → plan → approve → act flow.Reasoning loop (
sentinel-agent-llm/src/reasoning_loop.rs)capability_impls: HashMap<String, Box<dyn Capability>>field plus awith_capabilities(...)builder.invoke_capability()now dispatches to the registered concrete capability viacap.invoke(args, ctx), falling back to the previous stub result when no implementation is registered (preserving existing stub-mode behavior/tests).cap.invoke_inverse(...)for completed steps before marking themRolledBack, logging success / failure / no-inverse.CLI (
sentinel-tui/src/main.rs)run_agent()wires the LLM backend (Anthropic/OpenAI), executor, all capabilities, registry, default policy, and audit log into aReasoningLoop, then runs investigate → plan → approve → act. Approval comes from stdin or--auto-approve;--dry-runprints the plan without executing.Commands::Rungained--auto-approve; the stub body now callsrun_agent(...).list_capabilities()now enumerates the real capabilities fromall_capabilities(...)with kind, risk tier, and rollback support.Tests (
sentinel-agent-llm/tests/integration_test.rs)Notes on deviations from the patch spec
A few surgical adjustments were required so the workspace compiles and
cargo test --workspacepasses:all_capabilities(...)requires anArc<dyn CommandExecutorTrait>. The structCommandExecutordoes not implement that trait (onlyRealCommandExecutordoes), so the executor used in bothrun_agentandlist_capabilitiesisRealCommandExecutor. Addedsentinel-execto the TUI dependencies.CommandOutputconstruction was corrected to the actual struct (exit_code: Option<i32>, plus thetruncatedfield).CapabilityResult::Successexposes its payload asoutput(notdata), andAuditLogexposesevent_count()and persists on append (no separateflush()), so the test was adjusted accordingly.Testing
cargo build --workspace— cleancargo test --workspace— all green (integration suite: 6/6)cargo clippy --workspace --all-targets— no warningsDo not merge.
https://claude.ai/code/session_01PrvrHsArvuyDmDvn5Cuvri
Generated by Claude Code