Skip to content

Commit 28c05f2

Browse files
committed
docs: restore unrelated AGENTS and workflow comments
Signed-off-by: lucarlig <luca.carlig@ibm.com>
1 parent 69a8255 commit 28c05f2

File tree

3 files changed

+67
-24
lines changed

3 files changed

+67
-24
lines changed

.github/workflows/pytest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ jobs:
9191
# Rust MCP runtime (tools_rust/mcp_runtime) not needed for main pytest suite
9292
# (e2e_rust tests are excluded and run in separate workflow)
9393
# -----------------------------------------------------------
94+
9495
# 3️⃣ Run the tests with coverage (fail under 95 %total coverage)
9596
# -----------------------------------------------------------
9697
- name: 🧪 Run pytest

.secrets.baseline

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "^.secrets.baseline|package-lock.json|Cargo.lock|scripts/sign_image.sh|scripts/zap|sonar-project.properties|uv.lock|go.sum|mcpgateway/sri_hashes.json|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2026-04-15T08:29:37Z",
6+
"generated_at": "2026-04-15T08:45:20Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -200,39 +200,39 @@
200200
"hashed_secret": "f4793151b0607198d4de9b1ca458d3e25adf1cb7",
201201
"is_secret": false,
202202
"is_verified": false,
203-
"line_number": 110,
203+
"line_number": 112,
204204
"type": "Secret Keyword",
205205
"verified_result": null
206206
},
207207
{
208208
"hashed_secret": "fa9beb99e4029ad5a6615399e7bbae21356086b3",
209209
"is_secret": false,
210210
"is_verified": false,
211-
"line_number": 153,
211+
"line_number": 188,
212212
"type": "Secret Keyword",
213213
"verified_result": null
214214
},
215215
{
216216
"hashed_secret": "7b4455a56fbf1d198e45e04c437488514645a82c",
217217
"is_secret": false,
218218
"is_verified": false,
219-
"line_number": 155,
219+
"line_number": 190,
220220
"type": "Secret Keyword",
221221
"verified_result": null
222222
},
223223
{
224224
"hashed_secret": "90bd1b48e958257948487b90bee080ba5ed00caa",
225225
"is_secret": false,
226226
"is_verified": false,
227-
"line_number": 227,
227+
"line_number": 262,
228228
"type": "Hex High Entropy String",
229229
"verified_result": null
230230
},
231231
{
232232
"hashed_secret": "48ffbad96aa9c2b33f9486f5a3c2108198acb518",
233233
"is_secret": false,
234234
"is_verified": false,
235-
"line_number": 228,
235+
"line_number": 263,
236236
"type": "Hex High Entropy String",
237237
"verified_result": null
238238
}
@@ -690,53 +690,59 @@
690690
"crates/mcp_runtime/src/lib.rs": [
691691
{
692692
"hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684",
693-
"is_verified": false,
693+
"is_secret": false,
694+
"is_verified": true,
694695
"line_number": 10521,
695696
"type": "Basic Auth Credentials",
696-
"verified_result": null
697+
"verified_result": false
697698
}
698699
],
699700
"crates/mcp_runtime/src/observability.rs": [
700701
{
701702
"hashed_secret": "b7dd0ec3dc49487982011219e66db3716b6669c6",
702-
"is_verified": false,
703+
"is_secret": false,
704+
"is_verified": true,
703705
"line_number": 598,
704706
"type": "Secret Keyword",
705-
"verified_result": null
707+
"verified_result": false
706708
}
707709
],
708710
"crates/mcp_runtime/tests/runtime.rs": [
709711
{
710712
"hashed_secret": "5b204323030835cdda5d258742d1452e812988de",
711-
"is_verified": false,
713+
"is_secret": false,
714+
"is_verified": true,
712715
"line_number": 1643,
713716
"type": "Secret Keyword",
714-
"verified_result": null
717+
"verified_result": false
715718
},
716719
{
717720
"hashed_secret": "d6c1622f5e897dac7dcc4fab2cded03cb8240caa",
718-
"is_verified": false,
721+
"is_secret": false,
722+
"is_verified": true,
719723
"line_number": 5296,
720724
"type": "Secret Keyword",
721-
"verified_result": null
725+
"verified_result": false
722726
}
723727
],
724728
"crates/wrapper/scripts/test-fast-time-wrapper.sh": [
725729
{
726730
"hashed_secret": "5546721ffdfc2e5b0e4c0da38f10774f9ad50b09",
727-
"is_verified": false,
731+
"is_secret": false,
732+
"is_verified": true,
728733
"line_number": 12,
729734
"type": "Secret Keyword",
730-
"verified_result": null
735+
"verified_result": false
731736
}
732737
],
733738
"crates/wrapper/src/config.rs": [
734739
{
735740
"hashed_secret": "c8190eb36807e51dd78086805a24539885edda6b",
736-
"is_verified": false,
741+
"is_secret": false,
742+
"is_verified": true,
737743
"line_number": 9,
738744
"type": "Secret Keyword",
739-
"verified_result": null
745+
"verified_result": false
740746
}
741747
],
742748
"docker-compose-debug.yml": [

AGENTS.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ llms/ # End-user LLM guidance (not for code agents)
4848
```bash
4949
cp .env.example .env && make install-dev check-env # Complete setup
5050
make venv # Create virtual environment with uv
51-
make install-dev # Install with dev dependencies
51+
make install-dev # Install with dev dependencies (includes build-ui)
5252
make check-env # Verify .env against .env.example
53+
make build-ui # Rebuild Admin UI JS bundle (requires npm)
5354
```
5455

5556
### Development
@@ -65,10 +66,11 @@ make serve-ssl # HTTPS on :4444 (creates certs if needed)
6566
make autoflake isort black pre-commit
6667

6768
# Before committing, use ty, mypy and pyrefly to check just the new files, then run:
68-
make flake8 bandit interrogate pylint verify
69+
make ruff bandit interrogate pylint verify
6970

70-
# Before committing Rust changes (crates/ or tools_rust/):
71-
make rust-check # Runs fmt-check, clippy -D warnings, and cargo test for all Rust crates
71+
# Before committing Rust changes (tools_rust/):
72+
# Run fmt-check, clippy -D warnings, and cargo test for Rust crates
73+
cd tools_rust/mcp_runtime && cargo fmt --check && cargo clippy -- -D warnings && cargo test
7274
```
7375

7476
## Authentication & RBAC Overview
@@ -135,6 +137,39 @@ ContextForge implements a **two-layer security model**:
135137
- **Multi-tenancy architecture**: `docs/docs/architecture/multitenancy.md`
136138
- **OAuth token delegation**: `docs/docs/architecture/oauth-design.md`
137139

140+
## Observability Transaction Behavior
141+
142+
**Issue #3883 - Separate Session Pattern**
143+
144+
Observability write operations use **independent database sessions** that commit immediately (best-effort pattern). This means:
145+
146+
- Observability data persists even when the main request fails
147+
- Traces may show "in progress" or partial states for failed requests
148+
- **NOT atomic** with main request transaction (intentional trade-off)
149+
- Provides visibility into partial failures at the cost of atomicity
150+
151+
### Implementation Details
152+
153+
**Write methods** (use independent sessions):
154+
- `start_trace()`, `end_trace()`
155+
- `start_span()`, `end_span()`
156+
- `add_event()`, `record_token_usage()`, `record_metric()`, `delete_old_traces()`
157+
158+
**Query methods** (use request-scoped sessions):
159+
- `get_trace()`, `get_traces()`, `get_spans()`, etc.
160+
- These accept a `db: Session` parameter for RBAC/token scoping
161+
162+
**Context managers** (create single independent session for lifecycle):
163+
- `trace_span()`, `trace_tool_invocation()`, `trace_a2a_request()`
164+
165+
**Pattern**: Follows existing SQL instrumentation approach in `instrumentation/sqlalchemy.py:58-87`
166+
167+
**Middleware**: `ObservabilityMiddleware` no longer creates `request.state.db`. Each observability operation creates its own short-lived session.
168+
169+
**Security**: Query operations use request-scoped sessions for RBAC/token scoping. Write operations are not RBAC-protected (observability visibility is platform-wide).
170+
171+
**Connection Pool Sizing**: The separate session pattern creates 4-6 independent database sessions per traced request (trace start/end, span start/end, metrics, events). Default configuration (`DB_POOL_SIZE=200`, `DB_MAX_OVERFLOW=10`) provides 210 total connections, supporting ~35 concurrent traced requests. This is adequate for typical deployments. High-traffic production systems (>50 req/sec sustained) should increase pool size via environment variables: `DB_POOL_SIZE=500`, `DB_MAX_OVERFLOW=100` to support 80+ concurrent requests. Monitor for "QueuePool limit exceeded" errors and adjust pool sizing accordingly. Note: SQLite connections are capped at 50 due to file-based limitations.
172+
138173
## Key Environment Variables
139174

140175
Defaults come from `mcpgateway/config.py`. `.env.example` intentionally overrides a few for local/dev convenience.
@@ -333,5 +368,6 @@ When posting PR reviews, issue comments, or any public-facing text on GitHub, us
333368

334369
- `gh` for GitHub operations
335370
- `make` for build/test automation
336-
- `uv` for virtual environment management
337-
- Standard tools: pytest, black, isort, ruff, pylint
371+
- `uv` for virtual environment management and for `uv tool run` linter invocations
372+
- Dev-group tools installed in the venv: `pytest`, `mypy`, `bandit`, `pre-commit`, `prospector`, etc. (see `pyproject.toml` `[dependency-groups]`)
373+
- Formatters and linters (`black`, `isort`, `ruff`, `pylint`, `vulture`, `interrogate`, `radon`, `yamllint`, `tomlcheck`) are pinned in the `Makefile` and invoked on demand via `uv tool run`; always prefer the Makefile targets (`make black`, `make ruff`, `make pylint`, etc.) over calling the underlying tools directly

0 commit comments

Comments
 (0)