feat(git-credential): per-agent git_credentials_read_only override - #57
Merged
Conversation
Follow-up to #56: the global flag forces the whole fleet into one mode. A per-agent Option<bool> on [[mcp.agents]] now overrides the global default in either direction; None (omitted) inherits. Enables the mixed-fleet posture: read-only global default + one explicitly push-capable agent. Both values are operator-set config, never agent-controlled. Issuance log now records the minted mode.
…oundtrip test Self-review findings: (1) the minted mode (contents read/write) was only in the tracing log, not the audit JSONL — forensic gap for mixed-mode fleets; now recorded on every git_credential_result, including failure paths. (2) add a TOML deserialization test guarding the tri-state Option<bool> per-agent key.
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
Follow-up to #56. Adds a per-agent
git_credentials_read_onlyoverride on[[mcp.agents]]entries. The global[mcp] git_credentials_read_onlyremains the fleet default; a per-agent value wins over it in either direction. Omitted = inherit (backward compatible — existing configs behave identically).Problem
#56's flag is broker-global: either every agent gets read-only git credentials or every agent gets push-capable ones. Real fleets are mixed — e.g. one deployer agent that pushes, and reviewer/triage agents that must clone private repos but never push. The only workaround was running a second octobroker instance with a different config.
Design
McpAgentConfig::git_credentials_read_only: Option<bool>(#[serde(default)]→None= inherit global)./git-credential:agent.git_credentials_read_only.unwrap_or(mcp.git_credentials_read_only).Some(false)deliberately re-enables push over a global read-only default — that's the recommended posture (read-only fleet default + explicit push exceptions). Both values are operator-set config in the same file; an agent can never choose its own mode.contents=read|write).Changes
src/config.rs— newOption<bool>field onMcpAgentConfig, documented.src/git_credential.rs— effective-mode resolution + mode in the issuance log.README.md/config.example.toml— per-agent override documented with the mixed-fleet example.test_per_agent_read_only_overrides_global_write(global write, agent pinned read-only → mintscontents: read) andtest_per_agent_write_overrides_global_read_only(global read-only, agent pinned push-capable → mintscontents: write). Inheritance (None) is covered by the existing feat(git-credential): add git_credentials_read_only flag #56 tests.Testing
Self-review addendum (commit 8c6b92c)
Three independent review tracks (security/correctness, test quality, docs/compat) were run against the first commit. Docs/compat came back clean; two 🟡 findings were fixed:
contents: read|write) was only in the tracing log, not the durable audit JSONL.record_git_credential_resultnow takes amodefield, recorded on success and both failure paths (resolved from operator config before owner verification), so the audit trail alone can answer "did agent X hold push capability at time T". Endpoint tests assert the field.test_agent_git_credentials_read_only_toml_roundtripguarding the tri-stateOption<bool>(omitted → None, explicittrue/false→ pinned) against future serde-attribute refactors.Re-verified: clippy
-D warningsclean, 136 tests passed (0 failed).