Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
574c10d
chore(deps): bump httpx>=0.28.1 and anthropic>=0.40.0
ngoclam9415 Jul 7, 2026
d0c0102
Merge pull request #22 from aitomatic/chore/bump-httpx-anthropic-deps
ngoclam9415 Jul 7, 2026
92e3d83
feat(observability): add LangSmith as alternative tracing backend
ngoclam9415 Jul 7, 2026
9a3f5f8
Merge pull request #23 from aitomatic/feat/langsmith-tracing-backend
ngoclam9415 Jul 7, 2026
463ea80
fix(observability): sanitize LangSmith trace payloads
ngoclam9415 Jul 8, 2026
b418581
feat(skill): add dana cross-repo debug workflow
ngoclam9415 Jul 8, 2026
da6e5dc
Merge pull request #25 from aitomatic/fix/langsmith-trace-sanitizer
ngoclam9415 Jul 8, 2026
2bead91
feat(prompt): add public system prompt template override
ngoclam9415 Jul 11, 2026
9ae4d87
Merge remote-tracking branch 'origin/develop' into feat/public-system…
ngoclam9415 Jul 11, 2026
acb72ec
Merge pull request #26 from aitomatic/feat/public-system-prompt-override
ngoclam9415 Jul 16, 2026
b90aa67
feat: design ACP AgentSession kernel
ngoclam9415 Jul 16, 2026
b699d0f
docs: revise ACP AgentSession architecture
ngoclam9415 Jul 16, 2026
d0e7a98
docs: approve ACP AgentSession design
ngoclam9415 Jul 16, 2026
6613043
feat: define session journal facts and protected state
ngoclam9415 Jul 16, 2026
ec16753
feat: add sqlite and postgres session journals
ngoclam9415 Jul 16, 2026
8565f3c
feat: project journal conversation and host events
ngoclam9415 Jul 16, 2026
650b21f
feat: add durable text AgentSession
ngoclam9415 Jul 16, 2026
2de5c60
feat: migrate timelines into session journals
ngoclam9415 Jul 16, 2026
ccacdb8
feat: expose Dana over ACP stdio
ngoclam9415 Jul 16, 2026
69c6cb9
feat: cut over durable ACP conversation
ngoclam9415 Jul 16, 2026
d6c0abc
docs: add D1 briefing and manual test scripts
ngoclam9415 Jul 17, 2026
78163bf
chore: gitignore local v2 planning notes
ngoclam9415 Jul 28, 2026
afccf6c
feat: add event bus substrate (S1)
ngoclam9415 Jul 28, 2026
64c2fbe
chore: gitignore local agent tool dirs and scratch
ngoclam9415 Jul 28, 2026
fa3d347
fix: un-ignore tests/unit/core/guard (project test source, not scratch)
ngoclam9415 Jul 28, 2026
f4bab56
fix: cache native tool schemas to avoid RecursionError on long sessions
ngoclam9415 Jul 28, 2026
7f5d700
test: add llm guard live test
ngoclam9415 Jul 28, 2026
3f156f7
feat: add tool execution engine + permission policy (S3)
ngoclam9415 Jul 28, 2026
ba66c41
feat: wire EventBus into STAR loop (S2)
ngoclam9415 Jul 29, 2026
551eb8c
feat: extension auto-discovery + hot reload (S4)
ngoclam9415 Jul 29, 2026
7d2b236
docs: how to extend Dana (v2.0 extensibility backbone)
ngoclam9415 Jul 29, 2026
c188001
Merge pull request #28 from aitomatic/feat/extensibility-backbone
ngoclam9415 Aug 2, 2026
41e4285
feat(D3): add Operations model, effect metadata, and hard-deny-wins p…
ngoclam9415 Aug 3, 2026
1581eee
feat(D2): add Tool Execution Engine with cooperative latency and isol…
ngoclam9415 Aug 3, 2026
81f6167
fix(D2): cancellation race in isolated worker path, check-then-act ra…
ngoclam9415 Aug 3, 2026
946287a
feat(D2): add cancellation trees and kill escalation
ngoclam9415 Aug 3, 2026
1df159b
feat(D2): add Durable Jobs with cascade/detach
ngoclam9415 Aug 3, 2026
8fceca1
feat(D3): add Permission Modes and grant store
ngoclam9415 Aug 3, 2026
d5d68b8
feat(D3): add PolicyEvaluator, populate affected_locations, fix locat…
ngoclam9415 Aug 3, 2026
89ba184
feat(D2): extend ACP translation with tool states
ngoclam9415 Aug 3, 2026
8bb29d7
feat(D3): add ACP permission adapter, Policy Preflight, and mode stat…
ngoclam9415 Aug 4, 2026
577fc5f
feat(D3): add session/request_permission handler, wire PolicyEvaluato…
ngoclam9415 Aug 4, 2026
f15c829
feat(D5): MCP handshake, tools/list discovery, and schema conversion
ngoclam9415 Aug 4, 2026
c6c1698
feat(D5): stdio and HTTP MCP transport adapters
ngoclam9415 Aug 4, 2026
8a868ea
feat(D5): remove ad hoc MCP clients after official-protocol parity
ngoclam9415 Aug 4, 2026
6c27a10
feat(D4): add ACP model state, provider-neutral Conversation View, pr…
ngoclam9415 Aug 4, 2026
5267ea9
feat(mcp): D5 catalog adapter, namespaced identity, leases, and config
ngoclam9415 Aug 4, 2026
ef0d5e2
feat(d6): content normalization, MIME/size checks, and artifact store
ngoclam9415 Aug 4, 2026
cc976fe
test(d6): add edge case tests for content normalization and artifact …
ngoclam9415 Aug 4, 2026
7a1662f
fix(D6): schema migration v1→v2, reject embedded_resource path, remov…
ngoclam9415 Aug 4, 2026
33626f2
feat(D5): add MCP execution adapter, cancellation tracker, restore ha…
ngoclam9415 Aug 5, 2026
4c5db0f
feat(D6): add multimodal Conversation View blocks, ACP attachment con…
ngoclam9415 Aug 5, 2026
75fec8b
fix(D5): route MCP tools through remote adapter in execute/execute_as…
ngoclam9415 Aug 5, 2026
220fa9a
feat(D6): add provider capability validation and content_blocks suppo…
ngoclam9415 Aug 5, 2026
849b84e
feat(D2,D4): commit Sprint 2 residue before Sprint 3 kickoff
ngoclam9415 Aug 7, 2026
feaa043
feat(D7.1,D7.2): dana-code on AgentSession — async REPL + HostEvent b…
ngoclam9415 Aug 7, 2026
79df951
fix(D7): Wave 1 review polish — Ctrl-C teardown, factory defaults, ho…
ngoclam9415 Aug 10, 2026
4a43e27
fix(D7.1): close journal repo on REPL exit — fixes shutdown hang
ngoclam9415 Aug 10, 2026
d6b73d6
fix(D7.1): default_agent_factory must not pass llm_provider/model — f…
ngoclam9415 Aug 10, 2026
d79d469
fix(D7.2): suppress duplicate user-message echo in interactive REPL
ngoclam9415 Aug 10, 2026
c555fc3
fix(D7.1): remove redundant _current_version reach-in (M1)
ngoclam9415 Aug 10, 2026
77ab2a8
fix(D7): add AgentSession accessors + fix ACP policy import (shared i…
ngoclam9415 Aug 10, 2026
3061fa5
feat(D7.3): CLI capability inheritance — permissions, slash commands,…
ngoclam9415 Aug 10, 2026
9932c03
refactor(D7): move normalized_blocks_to_text_blocks to shared content…
ngoclam9415 Aug 10, 2026
ddaee9b
feat(D7.3): multimodal input (AC #5) + journal MODEL_CHANGED (M2)
ngoclam9415 Aug 10, 2026
d652826
fix(D7): default_agent_factory builds DanaCodingAgent (coding-assista…
ngoclam9415 Aug 10, 2026
f25fde3
fix(D7): AgentSession.prompt drives the streaming STAR loop (aquery_s…
ngoclam9415 Aug 10, 2026
2ab6b8e
test(D7.4): dana-code <-> dana-acp parity smoke (host-event stream eq…
ngoclam9415 Aug 11, 2026
31c31a1
fix(D7.5): ACP request_permission outcome schema + flip D7.4 permissi…
ngoclam9415 Aug 11, 2026
b5f443d
feat(D7.5): MCP tools reachable from a host turn via single-dispatch …
ngoclam9415 Aug 11, 2026
d04ad5d
feat(D7.6): native-tool catalog for policy classification + re-enable…
ngoclam9415 Aug 13, 2026
1a95323
fix(D7.6): hard-policy gaps — bash rm -rf rule keys off bash__execute…
ngoclam9415 Aug 13, 2026
5c47915
feat(D7): interactive NEEDS_PROMPT prompt in the CLI turn (follow-up 3)
ngoclam9415 Aug 13, 2026
a5316db
feat(D7): per-tool MCP UX + per-MCP policy (Approach A2)
ngoclam9415 Aug 13, 2026
9d55a26
D8(tests): close foreign-env test leak — pytest/ruff into uv dev grou…
ngoclam9415 Aug 31, 2026
f5f8a70
D8(tests): --continue-on-collection-errors on make test/test-unit so …
ngoclam9415 Aug 31, 2026
50434bb
D8(tests): declare license = MIT (PEP 639 SPDX expression) in [project]
ngoclam9415 Aug 31, 2026
558cb2d
D8(tests): align test_reap_child_pids with D5 TERM-then-KILL escalation
ngoclam9415 Aug 31, 2026
b194ee6
D8(getattr): remove STARAgent magic __getattr__ dispatch
ngoclam9415 Aug 31, 2026
49e8346
D8(getattr): migrate test off phantom _prompt_engineer attr (was magi…
ngoclam9415 Aug 31, 2026
4b2f253
D8(getattr): regression tests for AttributeError on unknown attrs + d…
ngoclam9415 Aug 31, 2026
967204d
D8(getattr): address review findings
ngoclam9415 Aug 31, 2026
3dafe8e
D8(skills): invert greedy default to opt-in via DANA_CLAUDE_SKILLS=1
ngoclam9415 Aug 31, 2026
e156848
D8(skills): gate ClaudeCodeSkills registration on DANA_CLAUDE_SKILLS=1
ngoclam9415 Aug 31, 2026
fb89b11
D8(skills): tests for opt-in gate
ngoclam9415 Aug 31, 2026
6778113
D8(cli): lazy log-dir resolution in LLMDebugLogger (no import-time mk…
ngoclam9415 Aug 31, 2026
7fbea89
D8(cli): argparse help/version layer for all entrypoints
ngoclam9415 Aug 31, 2026
92c29d2
D8(cli): subprocess smoke tests for --help/--version/bogus-flag/bare/…
ngoclam9415 Aug 31, 2026
9a9824e
D8(session): flat re-exports — AgentSession, TextBlock, FactType, Jou…
ngoclam9415 Aug 31, 2026
8f5b3de
D8(session): AgentSession.create() convenience constructor — journal+…
ngoclam9415 Aug 31, 2026
c6bf371
D8(session): reconcile timeline persistence id with journal session i…
ngoclam9415 Aug 31, 2026
1d72760
D8(session): docs/examples/host_hello.py — 17-line host, create() -> …
ngoclam9415 Aug 31, 2026
68e33ec
D8(session): tests — flat imports, create() defaults/explicit, idempo…
ngoclam9415 Aug 31, 2026
1561100
D8(session): host_hello accepts DANA_MOCK_LLM=true (Makefile conventi…
ngoclam9415 Aug 31, 2026
d2fbbfa
D8(readme): rewrite README against verified API
ngoclam9415 Aug 31, 2026
f68f65f
D8(readme): add MIT LICENSE at repo root
ngoclam9415 Aug 31, 2026
9cdb88b
D8(readme): document DANA_CONFIG_PATH as the config override; fix mod…
ngoclam9415 Aug 31, 2026
751219d
D8(pypi): rename distribution to dana-agent; update dist-name lookups
ngoclam9415 Aug 31, 2026
0e1a1c0
D8(pypi): bump build-system setuptools floor to >=77
ngoclam9415 Aug 31, 2026
6e4967d
D8(pypi): add tag-triggered PyPI publish workflow (trusted publishing)
ngoclam9415 Aug 31, 2026
e58faf9
D8(pypi): offer pip install dana-agent in README Installation
ngoclam9415 Aug 31, 2026
5d6682f
chore(D8): doc-sweep — dana-agent install names, real streaming API i…
ngoclam9415 Aug 31, 2026
bdb977d
ci(D8): postgres service for journal contract tests + pin uv to matri…
ngoclam9415 Sep 3, 2026
62e54e8
ci(D8): two-lane CI — postgres contract only on PRs to master
ngoclam9415 Sep 3, 2026
56b3eab
Merge pull request #27 from aitomatic/feat/acp-agent-session-kernel
ngoclam9415 Sep 3, 2026
adff3b2
chore: bump version to 0.2.1 (release train)
ngoclam9415 Sep 3, 2026
406c157
Merge pull request #31 from aitomatic/chore/bump-0.2.1
ngoclam9415 Sep 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
247 changes: 247 additions & 0 deletions .claude/skills/dana-cross-repo-debug/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
---
name: dana-cross-repo-debug
description: Debug dana-runtime bugs that surface through the sibling dana-os / dana-console integration. Use this skill whenever the user mentions console-bug, mise run console:dev, localhost:5273, Playground, dana-librarian, LangSmith/Langfuse tracing behavior through the console, or a bug where dana-os appears to use the wrong dana-runtime revision. It guides reproducing through tmux/UI/API, checking backend logs, binding dana-os to the local dana-runtime checkout, fixing runtime code, and verifying the cross-repo path end to end.
category: debugging
keywords: [dana-runtime, dana-os, dana-console, tmux, cross-repo, langsmith, playground]
metadata:
author: dana-runtime
version: "1.0.0"
---

# Dana Cross-Repo Debug

Use this skill when a bug is reported in dana-runtime but only appears when the sibling dana-os console is running. The important trap is that dana-os may pin `dana` to a remote git revision, so a fix in `/Users/lam/Desktop/repos/dana-runtime` is invisible until the dana-os workspace points to the local checkout or to a commit containing the fix.

## Repos And Surfaces

Assume these local paths unless the user says otherwise:

- Runtime repo: `/Users/lam/Desktop/repos/dana-runtime`
- Console/integration repo: `/Users/lam/Desktop/repos/dana-os-dana-odb-librarian`
- tmux session: `console-bug`
- Dev command: `mise run console:dev`
- Frontend: `http://localhost:5273/`
- Backend: `http://localhost:8100/`
- UI route: `http://localhost:5273/` -> `Playground` -> `@dana-librarian`
- Runtime librarian agent package: `/Users/lam/Desktop/repos/dana-os-dana-odb-librarian/dana-agents/dana-runtime-librarian`

## Working Rule

Debug the path the user actually runs. Do not stop after a unit test if the bug was reported through the console. Confirm:

1. The console backend imports `dana` from the intended checkout.
2. The failing request reaches dana-runtime code.
3. The tmux log no longer shows the original failure after the fix.

## Start With The Live Console

Inspect the tmux pane before changing code:

```bash
tmux capture-pane -t console-bug -p -S -240
tmux list-panes -t console-bug -a -F '#{session_name}:#{window_index}.#{pane_index} #{pane_current_path} #{pane_current_command}'
```

Check whether the servers are already running:

```bash
lsof -nP -iTCP:8100 -sTCP:LISTEN || true
lsof -nP -iTCP:5273 -sTCP:LISTEN || true
curl -I --max-time 5 http://localhost:5273/ || true
curl -sS -m 5 http://localhost:8100/docs | head || true
```

If `console:dev` refuses because port `8100` is in use, identify the holder. If it is a leaked uvicorn reload pair from the same console session, stop it before retrying. Prefer gentle termination first; use `kill -9` only for a stuck leaked process.

```bash
lsof -nP -iTCP:8100 -sTCP:LISTEN
kill <pid> <pid>
sleep 2
lsof -nP -iTCP:8100 -sTCP:LISTEN || true
```

Start or restart the console in the existing tmux session:

```bash
tmux send-keys -t console-bug 'mise run console:dev' Enter
sleep 8
tmux capture-pane -t console-bug -p -S -120
```

## Confirm Which Runtime Dana-OS Uses

This is the most common source of false verification. `uv run` can reinstall the remote pinned `dana` package at startup.

From the dana-os repo, inspect the source pin:

```bash
sed -n '1,80p' /Users/lam/Desktop/repos/dana-os-dana-odb-librarian/pyproject.toml
git -C /Users/lam/Desktop/repos/dana-os-dana-odb-librarian diff -- pyproject.toml uv.lock
```

Confirm the active interpreter imports local runtime files:

```bash
/Users/lam/Desktop/repos/dana-os-dana-odb-librarian/.venv/bin/python - <<'PY'
import dana
import dana.common.observable
print(dana.__file__)
print(dana.common.observable.__file__)
PY
```

Expected during local debugging:

```text
/Users/lam/Desktop/repos/dana-runtime/dana/__init__.py
/Users/lam/Desktop/repos/dana-runtime/dana/common/observable.py
```

## Bind Dana-OS To Local Dana-Runtime

If dana-os points at a remote git source:

```toml
dana = { git = "https://github.com/aitomatic/dana-runtime.git", rev = "..." }
```

For local debugging, change only the `dana` source to:

```toml
dana = { path = "../dana-runtime", editable = true }
```

Then refresh the lock in dana-os:

```bash
cd /Users/lam/Desktop/repos/dana-os-dana-odb-librarian
uv lock
```

Restart `console-bug`. Watch the startup log: it should reinstall `dana` from the local path, not fetch the remote git revision.

If the user wants a commit-bound integration instead of local editable debugging, first commit the dana-runtime fix, then pin dana-os back to:

```toml
dana = { git = "https://github.com/aitomatic/dana-runtime.git", rev = "<fix-commit-hash>" }
```

Run `uv lock` after changing the pin. Do not invent a commit hash before the fix is committed and available.

## Reproduce Through The Backend First

Use the backend API for fast, deterministic reproduction. It exercises the same backend path the Playground uses, without browser automation noise.

Find the registered librarian package:

```bash
curl -sS -m 20 http://localhost:8100/api/sessions \
-H 'content-type: application/json' \
--data '{"operation":"agent.find","args":{},"mode":"live"}' \
| jq '.result.agents[] | select(.name|contains("librarian"))'
```

Check readiness and mission id:

```bash
curl -sS -m 20 http://localhost:8100/api/sessions \
-H 'content-type: application/json' \
--data '{"operation":"agent.describe","args":{"agent_dir":"/Users/lam/Desktop/repos/dana-os-dana-odb-librarian/dana-agents/dana-runtime-librarian"},"mode":"live"}' \
| jq '.result | {name,operation,mission_id,readiness,errors}'
```

Run the crashing turn:

```bash
curl -sS -m 90 http://localhost:8100/api/sessions \
-H 'content-type: application/json' \
--data '{"operation":"agent.ask","args":{"mission_id":"mission:bms-librarian:primary","message":"model dump exclude_none=True mode=json"},"mode":"live"}' \
| jq '{invocation_id, ok:(.result.answer? != null), detail, answer:(.result.answer? // null)}'
```

Immediately inspect logs:

```bash
tmux capture-pane -t console-bug -p -S -160
```

Classify the first real failure, not the final wrapper error. For example:

- LangSmith serializer failures mention `langsmith/_internal/_serde.py`, `serialize_run_dict`, `Timeline.__repr__`, or `CompressedTimeline`.
- Wrong runtime source shows paths under `.venv/lib/python.../site-packages/dana` rather than `/Users/lam/Desktop/repos/dana-runtime/dana`.
- Event loop failures such as `Cannot run the event loop while another loop is running` may be secondary if they occur after another exception is already unwinding.

## Use The UI When Needed

Use the UI when the bug depends on selection state, readiness gating, mention insertion, websocket streaming, or visual behavior.

Manual path:

1. Open `http://localhost:5273/`.
2. Click `Playground` in the left rail.
3. In the composer, type `@dana-librarian`.
4. Select the suggestion if needed.
5. Send the prompt.
6. Watch `tmux capture-pane -t console-bug -p -S -160`.

For automation, use the repo's browser/devtools skill or a focused Puppeteer script. Prefer one script that keeps a single browser session open over many tiny commands, because session state can be lost between helper invocations.

## Fix In Dana-Runtime

Once the failure is traced to dana-runtime, edit the runtime repo. Use the existing code structure and add a regression test near the failing subsystem.

Common locations for this integration path:

- `dana/common/observable.py`: tracing backend dispatch.
- `dana/common/trace_sanitizer.py`: safe trace payload conversion.
- `dana/common/llm/llm.py`: sync and async LLM boundaries.
- `dana/core/llm/llm_caller.py`: provider invocation, retry, reactive compaction.
- `dana/core/runtime/base.py`: prompt build, native tools, runtime dispatch.
- `dana/core/timeline/*`: timeline and compressed timeline behavior.

After editing, run focused verification in dana-runtime:

```bash
cd /Users/lam/Desktop/repos/dana-runtime
uv run python -m py_compile <touched-python-files>
uv run ruff check <touched-python-files-and-tests>
uv run python -m pytest <focused-tests> -q
```

If the fix is about cross-repo behavior, finish with the live backend call and tmux log check. The final proof is the console operation returning HTTP 200 and the tmux pane showing normal runtime logs instead of the original error.

## Verification Checklist

Before reporting success, verify all that apply:

- `pyproject.toml` in dana-os points to local `../dana-runtime` for local debugging, or to a real fix commit hash for pinned integration.
- `uv.lock` in dana-os reflects the same source.
- The dana-os venv imports `dana` from `/Users/lam/Desktop/repos/dana-runtime/dana`.
- `mise run console:dev` is running in `console-bug`.
- `http://localhost:5273/` and `http://localhost:8100/` respond.
- `agent.describe` for dana-runtime-librarian reports readiness `ready`.
- `agent.ask` reproducer returns an `invocation_id` and `result.answer`.
- `tmux capture-pane` does not show the original crash after the fresh request.
- Focused dana-runtime tests and compile/lint checks pass.

## Report Format

Keep the report concise:

```markdown
Root cause: <one sentence>
Fix: <files changed and behavior>
Cross-repo binding: <local editable path or commit hash>
Verification:
- <command>: <result>
- <tmux/UI/API proof>: <result>
Unresolved questions: <only if any>
```

## Common Pitfalls

- Do not trust a successful local dana-runtime test if dana-os still pins a remote git revision.
- Do not keep restarting `console:dev` without checking leaked `8100` listeners.
- Do not treat old tmux scrollback as current. Restart cleanly or compare timestamps.
- Do not debug browser selectors before proving the backend operation fails.
- Do not commit dana-os dependency changes accidentally if they were only for local debugging.
23 changes: 23 additions & 0 deletions .claude/skills/dana-cross-repo-debug/evals/evals.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"skill_name": "dana-cross-repo-debug",
"evals": [
{
"id": 1,
"prompt": "The console-bug tmux session is running mise run console:dev. Chatting with dana-librarian in the Playground crashes, but dana-runtime tests pass locally. Debug it end to end and tell me what is actually running.",
"expected_output": "Agent should inspect tmux logs, check ports, verify dana-os dependency source, confirm imported dana path, reproduce through /api/sessions, and avoid claiming success from local tests alone.",
"files": []
},
{
"id": 2,
"prompt": "We fixed dana/common/observable.py in dana-runtime, but the Playground still shows the old LangSmith RecursionError. Figure out why and make the console use my local runtime checkout.",
"expected_output": "Agent should identify the remote git pin in dana-os pyproject/uv.lock, switch dana source to local editable ../dana-runtime for debugging, run uv lock, restart tmux console, and verify import paths.",
"files": []
},
{
"id": 3,
"prompt": "I need a clean repro for the dana-librarian bug without clicking around the UI. Use the running console backend to trigger the same agent.ask path and inspect the tmux log.",
"expected_output": "Agent should use /api/sessions agent.find, agent.describe, and agent.ask curl calls, then capture tmux logs and classify the first real failure.",
"files": []
}
]
}
64 changes: 63 additions & 1 deletion .github/workflows/pr-lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Lint + test on pull requests to protected branches
# Skips live and deep tests — those require API keys and run locally
#
# Two lanes:
# * PRs to develop + manual dispatch → fast lane, no postgres service,
# postgres parametrizations deselected (-k "not postgres")
# * PRs to master → full lane, real postgres:16 service,
# session-journal contract exercised against both backends

name: PR Lint & Test

Expand All @@ -10,6 +16,8 @@ on:

jobs:
lint-and-test:
# Fast lane: everything except PRs into master
if: github.event_name != 'pull_request' || github.base_ref != 'master'
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -22,6 +30,59 @@ jobs:
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
# Pin uv to the matrix python — otherwise uv resolves its own
# interpreter and the "(3.12)" job name lies about what ran.
python-version: ${{ matrix.python-version }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --extra dev

- name: Lint
run: uv run ruff check dana/

- name: Run tests (no live, no deep, no postgres)
env:
DANA_MOCK_LLM: "true"
DANA_USE_REAL_LLM: "false"
# No postgres service on this lane — deselect the [postgres]
# parametrizations so they skip-by-selection instead of failing
# their CI=true-without-DSN contract check.
run: uv run pytest tests/ -m "not live and not deep" -k "not postgres" -v --maxfail=10 --tb=short --durations=10

lint-and-test-postgres:
# Full lane: only PRs into master get the real-database contract
if: github.event_name == 'pull_request' && github.base_ref == 'master'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]

services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 10

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
Expand All @@ -34,8 +95,9 @@ jobs:
- name: Lint
run: uv run ruff check dana/

- name: Run tests (no live, no deep)
- name: Run tests (no live, no deep, with postgres contract)
env:
DANA_MOCK_LLM: "true"
DANA_USE_REAL_LLM: "false"
DANA_TEST_POSTGRES_DSN: postgresql://postgres:postgres@localhost:5432/postgres
run: uv run pytest tests/ -m "not live and not deep" -v --maxfail=10 --tb=short --durations=10
Loading
Loading