Skip to content

refactor: rename demo-one → enforcement-demo#16

Merged
beonde merged 19 commits into
mainfrom
refactor/rename-demo-one
May 15, 2026
Merged

refactor: rename demo-one → enforcement-demo#16
beonde merged 19 commits into
mainfrom
refactor/rename-demo-one

Conversation

@beonde

@beonde beonde commented May 11, 2026

Copy link
Copy Markdown
Member

Summary

Renames demo-oneenforcement-demo and demo-twopolicy-demo, restructures the repo for clarity, and addresses multiple issues:

Changes

  • Rename: demo-one/enforcement-demo/, demo-two/policy-demo/
  • Remove: mcp-demo/ (consolidated into enforcement-demo), run_video.py (replaced by --auto flag), scenario 5 (fake revocation — not realistic without server-side propagation delay)
  • Add: --verbose flag for badge inspection, --auto flag for non-interactive runs
  • Fix: time.sleep()asyncio.sleep() in async context, stale badge reuse, key mismatch in scenario 2
  • Deps: Pin capiscio-sdk>=2.7.1 and capiscio-mcp[mcp]>=2.7.1
  • Makefile: Add install, enforcement-demo, policy-demo targets, fix venv activation
  • Docs: Update READMEs to match 4-scenario demo, remove revocation references

- Rename directory demo-one/ to enforcement-demo/
- Update all internal references (logger names, docstrings, banners)
- Update Makefile targets, README.md, run_video.py, scripts/setup.sh
- No functional changes
Copilot AI review requested due to automatic review settings May 11, 2026 20:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Renames the former demo-one/ demo to enforcement-demo/ to better reflect its purpose, and updates repo entrypoints/docs to reference the new name.

Changes:

  • Renamed demo directory references across setup tooling (scripts/setup.sh, Makefile, run_video.py) and documentation (README.md).
  • Updated internal demo labeling (logger names, banners, headings) to use “enforcement-demo”.
  • Modified the enforcement demo MCP server entrypoint to run stdio in an async path and added presenter pauses in the demo runner.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/setup.sh Updates the per-demo .env scaffolding loop and help text to use enforcement-demo.
run_video.py Renames the demo key/command from demo-one to enforcement-demo.
README.md Reorganizes and updates demo listings and instructions for enforcement-demo.
Makefile Renames targets/phony entries from demo-one/video-one to enforcement-demo/video-enforcement.
enforcement-demo/setup.sh Updates setup banner text for the renamed demo.
enforcement-demo/server/main.py Renames docstring/logger and changes the server stdio startup implementation.
enforcement-demo/run_demo.py Renames banners and adds interactive pauses between scenarios.
enforcement-demo/requirements.txt Updates header comment to match the renamed demo.
enforcement-demo/README.md Updates title to match the renamed demo.
enforcement-demo/agents/untrusted_agent.py Updates docstring/logger name to match the renamed demo.
enforcement-demo/agents/trusted_agent.py Updates docstring/logger name to match the renamed demo.
enforcement-demo/.env.example Updates header comment to match the renamed demo.
Comments suppressed due to low confidence (6)

enforcement-demo/server/main.py:113

  • This entrypoint now relies on private/unstable capiscio-mcp internals (_capiscio_meta_ctx) and an internal attribute (server._server.run_stdio_async()). This is likely to break on capiscio-mcp upgrades and is inconsistent with the other demos that use the public server.run(transport="stdio") API; please switch to a public/ documented async run API (or add one upstream) rather than importing/using underscore-prefixed symbols.
    enforcement-demo/server/main.py:106
  • The PR description says there are no functional changes, but this file changes the server startup/runtime behavior (new async entrypoint, different stdio run path, explicit telemetry flush). Please either adjust the PR description or add a brief rationale here explaining the behavioral change and why the previous asyncio.run(build_server()); server.run(...) approach was incorrect.
    enforcement-demo/run_demo.py:11
  • This docstring says the demo runs four scenarios, but the script actually runs five (including badge revocation). Please update the scenario count and list so the top-level description matches the behavior and the README’s “5 scenarios” wording.
    enforcement-demo/run_demo.py:6
  • The docstring below still references an @guard decorator for enforcement, but the server code in this repo enforces trust levels via @server.tool(min_trust_level=...). Please update the wording so readers aren’t directed to a decorator that isn’t used/visible in the demo implementation.
    enforcement-demo/run_demo.py:96
  • pause() makes the demo block on stdin unconditionally; this will hang run_video.py / Makefile video-* runs and will also raise EOFError in non-interactive environments. Please make pauses optional (e.g., flag/env var), and/or auto-disable them when sys.stdin isn’t a TTY (and handle EOFError gracefully).
    enforcement-demo/setup.sh:27
  • These banner lines overflow the box width defined by the surrounding border, so the output won’t render as a clean aligned frame in terminals. Please adjust the spacing/text length so each line fits within the ╔══…══╗ / ╚══…══╝ width.

Comment thread README.md Outdated
Comment thread README.md Outdated
beonde added 2 commits May 11, 2026 16:39
- Rewrite enforcement-demo/README.md: quick start first, expected output,
  troubleshooting table, all 5 scenarios documented
- Root README: single copy-paste setup block, numbered prerequisites,
  de-emphasize demo-two, link to full docs instead of duplicating
- .env.example: default SERVER_ID to 'auto' for zero-friction setup
- Add --auto / --no-pause flag to skip interactive pauses
- Replace prose summary with visual results table (pass/fail per scenario)
- Suppress gRPC C-core noise (GRPC_VERBOSITY=NONE)
- Reorder setup.sh: scaffold .env before venv/deps (credentials first)
- Add binary download context (what it is, why ~15 MB)
- Document --auto flag in README with expected summary output
Copilot AI review requested due to automatic review settings May 11, 2026 20:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (5)

enforcement-demo/run_demo.py:29

  • argparse is imported but not used, and flags are parsed via sys.argv string checks. Either remove the unused import or switch to argparse for --auto/--no-pause parsing to keep the CLI implementation consistent.
    enforcement-demo/run_demo.py:17
  • The module docstring says enforcement is done by an @guard decorator, but the server actually uses @server.tool(min_trust_level=...). Update the docstring to match the real API to avoid misleading readers.
    enforcement-demo/run_demo.py:314
  • The presenter-facing output claims enforcement is via an @guard decorator, but the server code uses @server.tool(min_trust_level=...). Consider changing this message so the demo narration matches the actual code/API.
    enforcement-demo/server/main.py:113
  • This relies on private/internal APIs (capiscio_mcp.integrations.mcp._capiscio_meta_ctx and server._server.run_stdio_async()), which is brittle and may break on dependency updates. Prefer a public async run API (or wrap this in a small compatibility helper with a fallback to the supported server.run(transport="stdio")).
    enforcement-demo/server/main.py:105
  • The PR description states there are "No functional changes", but this introduces a new async entrypoint, manual meta-context injection, and telemetry flushing behavior for the server runtime. Either update the PR description to reflect the runtime behavior change or revert to the prior execution model.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread enforcement-demo/README.md Outdated
Comment thread enforcement-demo/README.md Outdated
Comment thread enforcement-demo/README.md Outdated
beonde added 2 commits May 11, 2026 21:42
- Remove CAPISCIO_REGISTRY_ENDPOINT (orphaned — no demo code reads it)
- Remove CAPISCIO_TRUSTED/UNTRUSTED_AGENT_NAME (auto-generated, clutters example)
- Comment out CAPISCIO_SERVER_URL (has sensible default, rarely overridden)
- Clarify CAPISCIO_SERVER_ID: document 'auto' behavior, mark as optional
- Only one required env var: CAPISCIO_API_KEY
- Update README env table with Required/Default columns
- Simplify setup.sh credential messaging
The Go binary (capiscio-core) reads CAPISCIO_REGISTRY_ENDPOINT to build
the JWKS URL for badge signature verification. Without it, BadgeVerifier
is nil and all badge checks return ErrBadgeInvalid — breaking scenarios
1 and 2 (trusted agent with valid badge → should ALLOW, would DENY).

CAPISCIO_SERVER_URL (Python SDK) and CAPISCIO_REGISTRY_ENDPOINT (Go binary)
look like duplicates but serve different components. Both must point to the
same registry. Added inline comments explaining this.

TODO: capiscio-mcp-python should auto-forward SERVER_URL → REGISTRY_ENDPOINT
before spawning the binary, eliminating the duplication.
Copilot AI review requested due to automatic review settings May 12, 2026 01:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (3)

enforcement-demo/server/main.py:113

  • This startup path relies on private/internal APIs (_capiscio_meta_ctx, server._server.run_stdio_async()) that aren’t part of the public CapiscioMCPServer contract and may not exist across the supported capiscio-mcp[mcp]>=2.4.0 range. Prefer a public async run entrypoint (or keep server.run(transport="stdio")) or bump/pin the minimum capiscio-mcp version and document the requirement.
    enforcement-demo/run_demo.py:29
  • argparse is imported but never used, which will fail make lint (ruff F401). Either remove the import or actually parse --auto/--no-pause via argparse and set AUTO_MODE from the parsed args.
    enforcement-demo/run_demo.py:23
  • The PR description says “No functional changes”, but this PR introduces new user-facing behavior (e.g., --auto / --no-pause mode and scenario pausing/summary output). Either update the PR description to reflect these functional changes, or remove the new behavior from this rename-only PR.

Comment thread scripts/setup.sh Outdated
Comment thread README.md Outdated
Comment thread enforcement-demo/README.md Outdated
Comment thread README.md Outdated
Comment thread enforcement-demo/README.md
Comment thread README.md Outdated
beonde added 2 commits May 11, 2026 22:43
Consistent naming with enforcement-demo and mcp-demo.
Updated all internal references (docstrings, loggers, banners, comments).
Copilot AI review requested due to automatic review settings May 12, 2026 02:45
- Server subprocess: logging level INFO → WARNING (eliminates all the
  capiscio_mcp, mcp.server, policy-demo.server INFO lines)
- Add gRPC noise suppression to both run_demo.py and server/main.py
- Add show_policy_yaml() — renders the active policy YAML inline with
  box-drawing characters so you can read/copy it from the terminal
- Shown before each phase's scenarios run

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 26 changed files in this pull request and generated 11 comments.

Comments suppressed due to low confidence (6)

enforcement-demo/run_demo.py:36

  • argparse is imported but never used. With the repo's ruff configuration (selecting F* rules), this will fail lint due to an unused import; either remove the import or wire up a real argparse-based CLI for --auto/--no-pause.
    enforcement-demo/run_demo.py:18
  • The module docstring says enforcement is via an @guard decorator, but the server code uses @server.tool(min_trust_level=...) instead. Update the wording so the demo explanation matches the actual mechanism being exercised.
    enforcement-demo/server/main.py:115
  • This server runner now depends on private/internal APIs (capiscio_mcp.integrations.mcp._capiscio_meta_ctx and server._server.run_stdio_async()). This is brittle across capiscio-mcp versions; prefer a public async run entrypoint (if available) or keep using server.run(transport="stdio") and address the supervisor-lifetime issue within supported APIs.
    policy-demo/server/main.py:5
  • The Policy Demo docstring still says it's the same server as demo-one, which no longer exists after the rename to enforcement-demo. Update the reference so the docs match the current directory/name.
    policy-demo/server/main.py:15
  • This docstring claims policy enforcement is performed by an @guard decorator, but the server actually uses @server.tool(min_trust_level=...) for trust gating. Update the explanation to match the real API so the demo doesn't teach an outdated concept.
    policy-demo/agents/untrusted_agent.py:7
  • The docstring references trust level being set by @guard, but this demo’s server implementation uses @server.tool(min_trust_level=...). Consider rephrasing to the public API used in this repo to avoid implying a decorator that callers won't find.

Comment thread Makefile
Comment thread Makefile
Comment thread Makefile
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread scripts/setup.sh Outdated
Comment thread scripts/setup.sh Outdated
Comment thread enforcement-demo/README.md Outdated
Comment thread enforcement-demo/README.md Outdated
Comment thread Makefile Outdated
beonde added 2 commits May 11, 2026 22:51
Each phase now flows: header → expected table → ACTION REQUIRED with
the YAML to copy/paste → pause → run scenarios. Phase 1 (baseline)
now also pauses so the user can set the initial policy first.
Copilot AI review requested due to automatic review settings May 12, 2026 02:54
Each phase now ends with a clear verdict comparing actual vs expected
outcomes. Mismatches show which scenario failed and what was expected.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 26 changed files in this pull request and generated 13 comments.

Comments suppressed due to low confidence (6)

enforcement-demo/run_demo.py:35

  • Unused import: argparse is imported but never used, and the Makefile’s lint step selects F (pyflakes), so this will fail CI/linting. Remove the import or switch AUTO_MODE parsing to argparse.
    enforcement-demo/run_demo.py:26
  • The run_demo docstring says enforcement happens via an @guard decorator and lists CAPISCIO_SERVER_ID as a prerequisite, but the server uses @server.tool(min_trust_level=...) and the demo’s .env.example defaults CAPISCIO_SERVER_ID=auto. Update the wording so the docs match how the demo actually works.
    enforcement-demo/server/main.py:113
  • This server runner relies on private/underscored APIs (capiscio_mcp.integrations.mcp._capiscio_meta_ctx and server._server.run_stdio_async()). That’s brittle and may break on dependency upgrades; prefer a public async run API (or add a small wrapper in capiscio_mcp that this demo can call).
    policy-demo/server/main.py:5
  • Docstring still says this is the “same MCP server as demo-one”, but the repo renamed that demo to enforcement-demo. Update the reference so the docs point to the correct demo name/directory.
    policy-demo/server/main.py:15
  • This docstring describes enforcement via an @guard decorator, but the server implementation uses @server.tool(min_trust_level=...). Update the wording to match the actual mechanism used by CapiscioMCPServer.
    enforcement-demo/server/main.py:121
  • PR description says “No functional changes”, but this code changes runtime behavior by switching from server.run(transport="stdio") to calling private async stdio run + injecting meta context + flushing telemetry on shutdown. Either update the PR description to reflect the behavioral change, or keep the original public server.run(...) path if functional parity is required.

Comment thread scripts/setup.sh Outdated
Comment thread scripts/setup.sh Outdated
Comment thread Makefile
Comment thread Makefile
Comment thread Makefile Outdated
Comment thread README.md Outdated
Comment thread enforcement-demo/README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Copilot AI review requested due to automatic review settings May 12, 2026 05:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 52 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (8)

multi-agent-demo/setup.sh:27

  • The --help text still claims local repos are at ../capiscio-sdk-python etc, but the script actually checks ../../.... Update the help output to match the real expected layout so developers don’t follow incorrect instructions.
    multi-agent-demo/setup.sh:100
  • In --local mode the dependency install is pip install -r requirements.txt 2>/dev/null || true, which can hide real install failures and leave agents with missing deps while the script reports success. Avoid swallowing pip errors; instead exclude/constraint CapiscIO packages explicitly and fail loudly if the remaining deps can’t be installed.
    enforcement-demo/server/main.py:117
  • This relies on private APIs (capiscio_mcp.integrations.mcp._capiscio_meta_ctx and server._server.run_stdio_async()). Private members can change without notice and may break the demo when upgrading capiscio-mcp. Prefer a public async run/serve API if available, or wrap this behind a compatibility helper with a fallback to server.run(transport='stdio').
    policy-demo/server/main.py:146
  • Same concern here: importing _capiscio_meta_ctx and calling server._server.run_stdio_async() depends on private internals. Please switch to a public API (or isolate this behind a small compatibility layer) to reduce breakage risk on SDK upgrades.
    enforcement-demo/run_demo.py:206
  • isError from client.call_tool() indicates a tool execution error, but it’s not necessarily an authorization/trust denial. Treating all isError results as DENY can misreport real failures (e.g., tool exceptions) as enforcement. Consider returning ERROR when isError is true unless the error text matches known guard-deny markers.
    policy-demo/run_demo.py:112
  • pause() is defined but never used (the script calls input(...) directly in multiple places). Remove the dead function or use it consistently so the pause behavior is centralized in one place.
    .github/copilot-instructions.md:126
  • The instructions still say cd agents/langchain-agent ... but agents now live under multi-agent-demo/agents/.... Update this command so contributors don’t end up in a non-existent path.
python run_demo.py --agent langchain

# Start single agent server
cd agents/langchain-agent && source .venv/bin/activate && python main.py --serve

Makefile:71

  • The PR description claims "No functional changes", but this PR introduces new runtime behavior (e.g., new policy-demo batching logic and new multi-agent-demo/shared event emitter package) and removes tooling like run_video.py/video make targets. Please update the PR description to reflect the actual scope so reviewers can assess risk accurately.
dev: dev-check ## Install ALL demos using local repos (pre-release testing)
	@echo ""
	@echo "═══════════════════════════════════════════════════════════"
	@echo "  Installing from LOCAL repos (dev mode)"
	@echo "═══════════════════════════════════════════════════════════"
	@echo ""
	# Shared event emitter
	$(PYTHON) -m pip install -e multi-agent-demo/shared/ -q
	# Local CapiscIO packages (overrides any PyPI versions)
	$(PYTHON) -m pip install -r $(LOCAL_DEPS)
	# Per-demo dependencies (non-capiscio deps like dotenv, httpx)
	$(PYTHON) -m pip install python-dotenv httpx uvicorn fastapi -q
	# Enforcement Demo
	cd enforcement-demo && $(PYTHON) -m pip install -r requirements.txt --no-deps -q 2>/dev/null || true
	# Agent frameworks
	$(PYTHON) -m pip install langchain langchain-openai langchain-community langgraph -q
	$(PYTHON) -m pip install "crewai>=1.12.0,<2.0.0" "crewai-tools>=1.12.0,<2.0.0" -q
	@echo ""

Comment thread mcp-demo/client/main.py Outdated
Comment thread mcp-demo/client/main.py Outdated
Comment thread mcp-demo/client/main.py Outdated
Comment thread .github/workflows/ci.yml
beonde added 2 commits May 12, 2026 21:26
- enforcement-demo: Updated agents to use CapiscIO.connect() with
  keys_dir (PoP-default). Simplified run_demo.py scenarios. Updated
  server/main.py to use current MCP patterns.

- policy-demo: Same SDK updates + updated policy YAML to match
  current policy engine format.

- Removed stale mcp-demo/ (replaced by policy-demo MCP integration).

- Updated CI, Makefile, README for new demo structure.
Copilot AI review requested due to automatic review settings May 14, 2026 19:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 56 out of 68 changed files in this pull request and generated 10 comments.

Comments suppressed due to low confidence (4)

policy-demo/.env.example:21

  • policy-demo/scripts/setup_policies.py requires CAPISCIO_ADMIN_JWT, but the .env.example no longer includes it. Add a placeholder + warning comment (similar to what was removed) so users can run policy setup successfully.
    multi-agent-demo/agents/langgraph-agent/main.py:475
  • Badge verification relies on agent._guard (a private attribute). This is brittle across SDK versions; prefer a public verification API (or middleware/guard instance exposed by the SDK) instead of reaching into underscored internals.
    .github/copilot-instructions.md:126
  • This command still references the old agent path (cd agents/langchain-agent), but agents now live under multi-agent-demo/agents/.... Update the path so the instructions are runnable.
# Run demo
python run_demo.py --agent langchain

# Start single agent server
cd agents/langchain-agent && source .venv/bin/activate && python main.py --serve

Makefile:97

  • make install prints PyPI versions via pip show langchain-capiscio, but the install recipe never installs langchain-capiscio (and multi-agent-demo/agents/langchain-agent/requirements.txt also doesn’t list it). This will likely make make install fail (grep gets no input) and also leaves the LangChain demo running without the CapiscIO guard/callback integration in release mode.
	@echo "✅ Release mode active. PyPI versions:"
	@$(PYTHON) -m pip show capiscio-sdk 2>/dev/null | grep -E "^(Name|Version)"
	@$(PYTHON) -m pip show capiscio-mcp 2>/dev/null | grep -E "^(Name|Version)"
	@$(PYTHON) -m pip show langchain-capiscio 2>/dev/null | grep -E "^(Name|Version)"

Comment thread enforcement-demo/run_demo.py Outdated
Comment thread enforcement-demo/run_demo.py Outdated
Comment thread enforcement-demo/README.md
Comment thread enforcement-demo/README.md
Comment thread README.md
Comment thread README.md
Comment thread README.md
Comment thread policy-demo/run_demo.py
Comment thread enforcement-demo/run_demo.py
Comment thread Makefile
beonde added 2 commits May 15, 2026 00:31
…ix key mismatch

- Pin capiscio-sdk and capiscio-mcp to >=2.7.1 (did:web fix)
- Add policy-demo install to Makefile install target
- Fix enforcement-demo Makefile runner (remove broken source cmd)
- Add policy-demo Makefile runner target
- Add --verbose flag to both demos
- Remove scenario 5 (fake revocation) from enforcement-demo
- Fix key mismatch between enforcement and policy demos
- Suppress PoP fallback warnings in demos
- Fix stale badge bug in policy-demo (fresh get_badge per scenario)
- Replace time.sleep(1) with await asyncio.sleep(1) in async context
- Remove scenario 5 (badge revocation) references from all READMEs
- Add policy-demo to Makefile .PHONY targets
- Update scenario counts from 5 to 4 in docs
Copilot AI review requested due to automatic review settings May 15, 2026 07:38
@beonde beonde merged commit 91de0e6 into main May 15, 2026
10 of 11 checks passed
@beonde beonde deleted the refactor/rename-demo-one branch May 15, 2026 07:41
@beonde beonde removed the request for review from Copilot May 15, 2026 08:00
@beonde beonde restored the refactor/rename-demo-one branch May 22, 2026 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants