feat: canonical shared runtime-profiles config with typed auth refs (#19) #30
Closed
jcwalker3
wants to merge 0 commits from
feat/json-runtime-profiles into master
pull from: feat/json-runtime-profiles
merge into: :master
:master
:feat/issue-812-publish-unpublished-commit
:feat/issue-634-readonly-system-health-api
:feat/issue-633-console-authz-audit-model
:feat/issue-798-worker-registry-schema
:feat/issue-610-live-remote-parity
:docs/issue-632-web-console-architecture
:feat/issue-628-autonomous-handoffs-orchestration
:fix/issue-790-slice-a-heartbeat-policy
:fix/issue-760-exact-owner-renewal
:fix/issue-787-kill-segment-separators
:chore/issue-681-preserve-review-session-wip
No Reviewers
Labels
Clear labels
allocator
anti-stomp
architecture
bug
chore
codex
concurrency
contamination
control-plane
dashboard
database
design
documentation
enhancement
gitea
glitchtip
important
incident
incident-bridge
integration
jenkins
labels
leases
mcp
mcp-health
mcp-menu
multi-project
mutating
nice-to-have
observability
portability
preflight
protected-branch
queue
read-only
reconnect
recovery
refactor
release
reliability
resumable-review
reviewer
roadmap
safety
security
self-hosted
sentry
stale-runtime
status:blocked
status:in-progress
status:pr-open
status:ready
terminal-lock
testing
tracker
type:bug
type:feature
type:feature
type:guardrail
visibility
workflow
workflow-hardening
workflow-hardening
Controller-owned work allocator
Prevent concurrent LLM session stomping
Architecture / structural design
OpenAI Codex client / workflow session surface
Concurrent session safety
Workflow or session contamination incident
MCP control-plane coordination and allocation authority
MCP operational dashboard/queue view
Internal coordination storage (SQLite/Postgres)
Design / investigation, no implementation
Docs / runbooks
New feature or improvement
Gitea MCP workflow
GlitchTip integration
Operational or process incident requiring durable audit trail
Sentry-to-Gitea incident bridging
Integration testing
Jenkins integration
Label taxonomy management
Lease adopt/release/expire lifecycle
MCP server / tooling
MCP namespace and runtime health
MCP menu surface
Work spanning multiple monitoring projects or Gitea repos
Mutating action; requires gating
Observability, metrics, traces, error reporting
Cross-platform / portability
Shared preflight gates before mutation
Protected branch / stable-branch policy concern
Work queue visibility and allocation
Read-only, no mutation
MCP client reconnect/reload recovery path
Recovery paths for stale/foreign leases
Code refactor / restructure
Release / versioning
Reliability / failure handling
Persist and resume prepared review verdicts across sessions
Reviewer workflow tooling
Roadmap / umbrella issue
Safety rails and fail-closed mutation guards
Security / trust boundary
Self-hosted infrastructure integration
Sentry error monitoring integration
Stale backend daemon / runtime-vs-master parity failures
Issue is blocked
Issue is being worked on
Issue has an open pull request
Issue is ready for work
Terminal review lock (#332) path
Tests / test coverage
Issue tracker hygiene / meta
Bug or defect
Feature or enhancement
Feature or enhancement
Safety gate or guardrail
Workflow state visibility for LLMs/operators
Cross-tool workflow
LLM workflow coordination hardening
LLM workflow coordination hardening
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Scaled-Tech-Consulting/Gitea-Tools#30
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Completes issue #19. Refs roadmap #10.
Problem
LLM MCP configs were drifting — each client's
mcp_config.jsonduplicatingGITEA_USER_*/GITEA_PASS_*/GITEA_SITE_*blocks and sometimes raw tokens. That duplicates runtime profiles, exposes secrets, and makes identity/merge safety hard to reason about.Solution
One canonical profiles file; each LLM launcher is a thin pointer.
Canonical file:
Thin launcher (Claude/Gemini/Codex) — two env vars, no secrets:
Implemented format
version(must be1) +profilesmap.base_url,username,default_owner,execution_profile, and a typedauthreference:{ "type": "keychain", "id": "..." }→ macOS keychain (security find-generic-password, on-demand).{ "type": "env", "name": "..." }→ named env var.token/passwordkeys are rejected (never accepted or echoed).GITEA_MCP_CONFIG(path) +GITEA_MCP_PROFILE(name).Precedence
Explicit process env vars (
GITEA_PROFILE_NAME,GITEA_BASE_URL,GITEA_TOKEN, …) override the JSON profile; the JSON profile fills only what env leaves unset.GITEA_MCP_CONFIGunset ⇒ legacy env-only mode (unchanged).Safety
ConfigErrorthat never prints file contents, tokens, or passwords.Tests / checks
tests/test_config.py— 31 cases: legacy env-only, selection, multiple profiles, missing/unset profile, invalid JSON (no leak), unsupported version, env-override precedence, keychain + env auth parsing & resolution, missing-secret errors, inline token/password redaction, no-network parse.get_profile/get_auth_header/mcp tests unchanged → backwards compat). JUnit XML (harness swallows pytest stdout on multi-file runs).py_compileclean; example JSON validated; real configs gitignored (gitea-mcp*.json).Files changed
gitea_config.py(canonical loader/selector/auth-resolver),gitea_auth.py(get_profileoverlay +get_auth_headerfallback),tests/test_config.py,gitea-mcp.example.json,README.md,.env.example.⚠️ Authored by me — do not self-merge. Needs review by another author.
Let one MCP server select among named Gitea runtime profiles from a JSON file instead of editing code or juggling many .env files: GITEA_MCP_CONFIG=/path/to/gitea-mcp.json GITEA_MCP_PROFILE=dev - New gitea_config.py: load/validate the JSON, select the named profile, and resolve its token by env-var reference. Profiles supply base_url, profile_name, token_env, owner/repo, allowed/forbidden operations, and audit label. - gitea_auth.get_profile() now overlays env over the selected JSON profile: explicit env vars win, the JSON profile fills only what env leaves unset. - gitea_auth.get_auth_header() gains a JSON token_env fallback after explicit env tokens (env still wins). Security / safety: - Tokens are referenced by env-var NAME (token_env); an inline "token" is rejected and never echoed. The value is never stored in or returned as profile metadata. - Fail-safe errors: missing file / invalid JSON / unknown or unset selected profile raise a clear ConfigError that never prints file contents or tokens (JSONDecodeError context is suppressed so the raw file text can't surface). - No network calls during config parsing. - Real config files are gitignored (gitea-mcp*.json), example kept. Backwards compatible: with GITEA_MCP_CONFIG unset, behaviour is exactly the prior env-only behaviour (all existing get_profile/get_auth_header tests pass unchanged). Docs: README JSON-profiles section + env table rows, .env.example placeholders, gitea-mcp.example.json. Tests: tests/test_config.py (22 cases) — env-only, selection, multiple profiles, env-override precedence, missing file, invalid JSON, missing/unset profile, inline-token rejection + redaction, and no-network-during-parse. Refs #10. Note: issue #19 (env-based profiles) was already implemented and closed; this JSON-file capability is adjacent new scope tracked under the roadmap rather than reopening #19. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>Superseded by the canonical runtime-profiles work under #19 (branch
feat/issue-19-canonical-runtime-profiles). That schema is a refinement of this one: addsversion, richer profile fields (username,default_owner,execution_profile), and typed auth references ({type: keychain|env, ...}). Closing this PR in favor of #19.feat: JSON multi-profile runtime config for Gitea MCP (roadmap #10)to feat: canonical shared runtime-profiles config with typed auth refs (#19)Correction to my earlier comment: this PR is not being closed. Per direction (reuse #30, no competing PR), it was reopened and reworked in place to the canonical shared runtime-profiles schema (version + typed keychain/env auth refs). It now completes #19. Title/body updated.
Reopened. This PR was found closed without merging —
masteris still at the #29 merge and does not contain this branch's commits (3aaba73,b88ca0c). Branchfeat/json-runtime-profilesre-pushed and PR reopened so an eligible (non-author) reviewer can merge it. Merge this before #32 (which stacks on it).Pull request closed