Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
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
4 changes: 3 additions & 1 deletion .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: 2
reviews:
request_changes_workflow: true
pre_merge_checks:
docstrings:
mode: off
1 change: 1 addition & 0 deletions .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
security:
Expand Down
112 changes: 77 additions & 35 deletions .github/workflows/strix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ concurrency:
permissions:
actions: read
contents: read
models: read

jobs:
strix:
Expand Down Expand Up @@ -80,21 +81,24 @@ jobs:
- name: Gate Strix secrets
id: gate
env:
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
STRIX_GITHUB_MODELS_MODEL: ${{ secrets.STRIX_LLM || 'openai/gpt-5' }}
STRIX_OPENAI_API_KEY: ${{ secrets.STRIX_OPENAI_API_KEY }}
run: |
strix_llm="github/gpt-4o"
llm_api_key="$(printf '%s' "$LLM_API_KEY" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
if [ -z "$llm_api_key" ]; then
# On protected/privileged events, fail-closed: missing secrets must
# not silently produce a green check.
if [ "$GITHUB_EVENT_NAME" = "push" ] || [ "$GITHUB_EVENT_NAME" = "schedule" ] || [ "$GITHUB_EVENT_NAME" = "pull_request_target" ]; then
echo '::error::Strix secrets not configured on protected or privileged event; failing closed.'
strix_model="$(printf '%s' "$STRIX_GITHUB_MODELS_MODEL" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
case "$strix_model" in
openai/gpt-5 | openai/gpt-5-* | openai/gpt-5.[0-9]* | openai/gpt-[6-9]* | openai/gpt-[1-9][0-9]* | \
openai/openai/gpt-5 | openai/openai/gpt-5-* | openai/openai/gpt-5.[0-9]* | openai/openai/gpt-[6-9]* | openai/openai/gpt-[1-9][0-9]*)
echo 'enabled=true' >> "$GITHUB_OUTPUT"
;;
*)
echo '::error::STRIX_LLM must select an OpenAI GPT-5 or newer model, for example openai/gpt-5.'
exit 1
fi
echo 'enabled=false' >> "$GITHUB_OUTPUT"
echo 'Strix secrets not configured; skipping.'
;;
esac
if [ -n "$(printf '%s' "$STRIX_OPENAI_API_KEY" | tr -d '\r\n')" ]; then
echo 'provider_mode=openai_direct' >> "$GITHUB_OUTPUT"
else
echo 'enabled=true' >> "$GITHUB_OUTPUT"
echo 'provider_mode=github_models' >> "$GITHUB_OUTPUT"
fi

- name: Gate GCP credentials
Expand All @@ -114,10 +118,11 @@ jobs:
id: auth_gate
if: steps.gate.outputs.enabled == 'true'
env:
DEFAULT_PROVIDER: gemini
STRIX_GITHUB_MODELS_MODEL: ${{ secrets.STRIX_LLM || 'openai/gpt-5' }}
DEFAULT_PROVIDER: openai
run: |
. "$TRUSTED_WORKSPACE/scripts/ci/strix_model_utils.sh"
strix_llm="github/gpt-4o"
strix_llm="$(trim_whitespace "$STRIX_GITHUB_MODELS_MODEL")"
requires_vertex_auth='false'
model_auth_rc=0
model_requires_vertex_auth "$strix_llm" || model_auth_rc=$?
Expand Down Expand Up @@ -195,7 +200,7 @@ jobs:
- name: Mask LLM API key
if: steps.gate.outputs.enabled == 'true' && steps.auth_gate.outputs.can_run == 'true'
env:
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_API_KEY: ${{ secrets.STRIX_OPENAI_API_KEY || github.token }}
run: |
# Sanitize CR/LF before masking to prevent broken ::add-mask::
# commands and potential workflow command injection.
Expand All @@ -211,7 +216,7 @@ jobs:
- name: Prepare LLM API key input file
if: steps.gate.outputs.enabled == 'true' && steps.auth_gate.outputs.can_run == 'true'
env:
LLM_API_KEY_SECRET: ${{ secrets.LLM_API_KEY }}
LLM_API_KEY_SECRET: ${{ secrets.STRIX_OPENAI_API_KEY || github.token }}
run: |
if [ -n "$LLM_API_KEY_SECRET" ]; then
umask 077
Expand All @@ -222,37 +227,59 @@ jobs:

- name: Prepare Strix model input file
if: steps.gate.outputs.enabled == 'true' && steps.auth_gate.outputs.can_run == 'true'
env:
STRIX_GITHUB_MODELS_MODEL: ${{ secrets.STRIX_LLM || 'openai/gpt-5' }}
run: |
umask 077
strix_llm_file="$RUNNER_TEMP/strix_llm.txt"
printf '%s' "github/gpt-4o" > "$strix_llm_file"
strix_model="$(printf '%s' "$STRIX_GITHUB_MODELS_MODEL" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
if [ "${{ steps.gate.outputs.provider_mode }}" = 'openai_direct' ]; then
case "$strix_model" in
openai/openai/*)
printf '%s' "${strix_model#openai/}" > "$strix_llm_file"
;;
openai/*)
printf '%s' "$strix_model" > "$strix_llm_file"
;;
*)
echo '::error::STRIX_LLM must select an OpenAI GPT-5 or newer model, for example openai/gpt-5.'
exit 1
;;
esac
else
case "$strix_model" in
openai/gpt-5 | openai/gpt-5-* | openai/gpt-5.[0-9]* | openai/gpt-[6-9]* | openai/gpt-[1-9][0-9]*)
printf 'openai/%s' "$strix_model" > "$strix_llm_file"
;;
openai/openai/gpt-5 | openai/openai/gpt-5-* | openai/openai/gpt-5.[0-9]* | openai/openai/gpt-[6-9]* | openai/openai/gpt-[1-9][0-9]*)
printf '%s' "$strix_model" > "$strix_llm_file"
;;
*)
echo '::error::STRIX_LLM must select a GitHub Models OpenAI GPT-5 or newer model, for example openai/gpt-5.'
exit 1
;;
esac
fi
echo "STRIX_LLM_FILE=$strix_llm_file" >> "$GITHUB_ENV"

- name: Prepare LLM API base input file
if: steps.gate.outputs.enabled == 'true' && steps.auth_gate.outputs.can_run == 'true'
env:
LLM_API_BASE_SECRET: ${{ secrets.LLM_API_BASE }}
if: steps.gate.outputs.enabled == 'true' && steps.auth_gate.outputs.can_run == 'true' && steps.gate.outputs.provider_mode == 'github_models'
run: |
if [ -n "$LLM_API_BASE_SECRET" ]; then
umask 077
llm_api_base_file="$RUNNER_TEMP/llm_api_base.txt"
printf '%s' "$LLM_API_BASE_SECRET" > "$llm_api_base_file"
echo "LLM_API_BASE_FILE=$llm_api_base_file" >> "$GITHUB_ENV"
fi
umask 077
llm_api_base_file="$RUNNER_TEMP/llm_api_base.txt"
printf '%s' "https://models.github.ai/inference" > "$llm_api_base_file"
echo "LLM_API_BASE_FILE=$llm_api_base_file" >> "$GITHUB_ENV"

- name: Run Strix (quick)
if: steps.gate.outputs.enabled == 'true' && steps.auth_gate.outputs.can_run == 'true'
env:
STRIX_LLM_FILE: ${{ env.STRIX_LLM_FILE }}
STRIX_LLM_DEFAULT_PROVIDER: gemini
GEMINI_LOCATION: GLOBAL
STRIX_LLM_DEFAULT_PROVIDER: openai
LLM_API_KEY_FILE: ${{ env.LLM_API_KEY_FILE }}
LLM_API_BASE_FILE: ${{ env.LLM_API_BASE_FILE }}
STRIX_GEMINI_FALLBACK_MODELS: "gemini/gemini-2.5-flash gemini/gemini-2.5-pro"
STRIX_VERTEX_FALLBACK_MODELS: "vertex_ai/gemini-2.5-pro vertex_ai/gemini-2.5-flash"
STRIX_TARGET_PATH: ./
STRIX_SOURCE_DIRS: .
STRIX_REASONING_EFFORT: ${{ github.event_name == 'push' && 'low' || 'minimal' }}
STRIX_REASONING_EFFORT: low
STRIX_LLM_MAX_RETRIES: 1
LLM_TIMEOUT: 90
STRIX_MEMORY_COMPRESSOR_TIMEOUT: 10
Expand All @@ -274,9 +301,24 @@ jobs:
- name: Collect Strix reports for artifact upload
if: ${{ always() && !cancelled() && steps.gate.outputs.enabled == 'true' && steps.auth_gate.outputs.can_run == 'true' }}
run: |
if [ -d "$TRUSTED_WORKSPACE/strix_runs" ]; then
mkdir -p "$GITHUB_WORKSPACE/strix_runs"
cp -R "$TRUSTED_WORKSPACE/strix_runs"/. "$GITHUB_WORKSPACE/strix_runs"/
set -euo pipefail
mkdir -p "$GITHUB_WORKSPACE/strix_runs"
copied_reports=0
for candidate_dir in "$TRUSTED_WORKSPACE/strix_runs" "$RUNNER_TEMP/strix_runs"; do
if [ -d "$candidate_dir" ] && [ -n "$(find "$candidate_dir" -mindepth 1 -print -quit)" ]; then
cp -R "$candidate_dir"/. "$GITHUB_WORKSPACE/strix_runs"/
copied_reports=1
fi
done
if [ -n "$(find "$GITHUB_WORKSPACE/strix_runs" -mindepth 1 -print -quit)" ]; then
copied_reports=1
fi
if [ "$copied_reports" -eq 0 ]; then
{
echo "Strix scan completed without structured report files."
echo "run_id=$GITHUB_RUN_ID"
echo "head_sha=$GITHUB_SHA"
} > "$GITHUB_WORKSPACE/strix_runs/scan-summary.txt"
fi

- name: Upload Strix reports artifact
Expand All @@ -285,5 +327,5 @@ jobs:
with:
name: strix-reports
path: strix_runs/
if-no-files-found: warn
if-no-files-found: error
retention-days: 5
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ backend/.venv/
venv/
.venv/
__pycache__/
**/__pycache__/
*.py[cod]
*$py.class
*.so
Expand Down
30 changes: 29 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
explicit `if: ${{ always() }}` upload steps when needed.
- Prefer upgrading or removing vulnerable dependencies over downgrading patched
packages unless compatibility evidence is recorded in the PR.
- Strix Security Scan must use `github/gpt-4o` as the default model to bypass Vertex AI GCP credential prerequisites in PR bounds.
- Strix Security Scan must use an OpenAI GPT-5-or-newer model. Prefer GitHub
Models with `models: read`, but verify actual inference availability, not only
catalog presence. If the repo token cannot invoke GitHub Models GPT-5, use
only an explicitly named `STRIX_OPENAI_API_KEY` direct GPT-5 credential rather
than downgrading to Gemini, GPT-4o, or GPT-4.1; record the inference evidence
in the PR. Do not repurpose generic `LLM_API_KEY` for direct OpenAI Strix
calls, because it may hold a GitHub Models token or PAT.

## PR automation and review defaults

Expand Down Expand Up @@ -60,17 +66,39 @@
storing user-supplied tags for later UI rendering. Parsed email display fields
must not persist active HTML/script markup; preserve message/thread identifiers
separately from UI-safe subject/body, address, and attachment display text.
- Mail connection updates and workers must validate server-side SMTP, POP3,
IMAP, and relay destinations before persistence or network connection. POP3
credentials are required for POP3 sync;
missing credentials must fail the sync path instead of logging a successful
no-op. Do not place sensitive credential values, secret-derived values, or
password-shaped field names in logs or raised exception text; use static
non-secret labels such as "credential secret" instead.
- New database tables and columns must use at least two-word `snake_case` names;
avoid single-token columns such as `id`, `title`, `status`, or `priority` on
newly introduced objects.
- When reviews find public/private identifier leaks, stale API fixture shapes, or recurring bug patterns, update tests, frontend mocks, E2E mocks, README examples, architecture docs, and explicitly record the anti-pattern in `AGENTS.md` so the same bug pattern does not reappear in copied examples.
- When reviews find inert navigation/dead-space controls, either wire them to an
implemented workspace route/API or remove the control; do not leave
high-traffic drawer/sidebar entries as permanent `준비 중` copy.
- Execution steps resulting in `Timeout`, `Fatal`, `Warn`, or `Denied` outputs are considered hard failures. Tests must run without these warnings to be considered passing.
- DB-affecting API slices need both mocked fast tests and a real PostgreSQL
bootstrap/smoke path before PR merge evidence is considered complete.
- DAV/WebDAV/CalDAV routes are private integration surfaces unless explicitly
documented otherwise. Register them with the default signed-session dependency,
escape XML response fields before interpolation, and keep path values separate
from log-safe display values.
- Self-hosted runner WebSocket routes must validate both a signed bearer session
and a server-side WorkspaceRunnerConfig registration token before accepting the
socket. Do not use the raw path token as identity, a log value, or the sole
active-connection key.
- Calendar UI actions must request `/api/calendar/writeback-intent` with
server-authoritative source selection and provenance. Do not wire browser
actions back to legacy `/api/calendar/sync` unless a trusted backend credential
dependency and source-owner contract are explicitly in scope.
- Self-sent knowledge extraction must first prove true self-to-self addressing,
stay idempotent per source email, preserve email/thread provenance, and store
only plain-text task titles. Do not create unlinked knowledge tasks from raw
dict payloads when the source email row is unavailable.

## Development environment and tooling defaults

Expand Down
5 changes: 3 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ it must never fall back to scanning trusted-base content for a modified PR path.
Pull request scans split scoped changed files into small bounded batches before
the timeout-driven rebalance path, so large PRs do not spend the whole required
check budget on one oversized Strix invocation. Strix remains a required
Medium-or-higher gate, while third-party LLM/provider warnings are tracked
separately unless they make the scan incomplete.
Medium-or-higher gate. The workflow uses GitHub Models through `models: read`,
the OpenAI-compatible GitHub Models endpoint, and an OpenAI GPT-5-or-newer
model; non-GPT-5 provider fallbacks are not valid PR evidence for this gate.
Merge-gate governance for Strix, CodeRabbit, and required review evidence is
documented in `docs/development/merge-gate-policy.md`.

Expand Down
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,23 @@ mail/calendar/file systems.
open-source observability.
- PR automation is metadata-only and uses current-head robot-review evidence plus
required checks. Human approval is not awaited by default under repo policy.
- Strix PR/security evidence requires an OpenAI GPT-5+ model. The workflow
prefers GitHub Models with `models: read`, verifies real inference
availability, and uses only an explicit `STRIX_OPENAI_API_KEY` direct GPT-5
credential instead of downgrading to GPT-4-era models when GitHub Models has
not enabled GPT-5 for the repo token. Pending CodeRabbit or check evidence is
a wait state, not a hard blocker.

## Agentic Ontology & Auto-Organization (Planned)
## Agentic Ontology & Auto-Organization

- **DAG Ontology**: The system evaluates a Directed Acyclic Graph (DAG) for sender relationships to determine "what this sender means to the user", allowing the AI Agent to decide subsequent tasks based on dynamic relationship contexts.
- **Self-Sent Knowledge Indexing**: Emails sent to oneself are automatically parsed and structured into the connected WebDAV/Notes repository, creating a seamless personal knowledge base.
- **Sender ontology**: The backend classifies sender relationships and returns a
deterministic next-action hint, such as reply/task tracking for colleagues or
summary-first handling for newsletters. Source-id filtered graph persistence is
still an episode task.
- **Self-sent knowledge capture**: IMAP-imported emails sent from a user to the
same address now create one idempotent, source-linked `self_sent_knowledge`
ticket task with a plain-text memo title. WebDAV/Notes materialization remains
future work and must write back to customer-owned sources.

## Five-minute local path

Expand Down Expand Up @@ -77,6 +89,12 @@ npm run build
npm run dev
```

`next.config.ts` caps static generation concurrency by default
(`NEXT_STATIC_GENERATION_MAX_CONCURRENCY=2`,
`NEXT_STATIC_GENERATION_MIN_PAGES_PER_WORKER=50`) so constrained CI/build
machines do not fan out excessive Node/PostCSS workers. Raise those values only
with explicit build evidence.

## Threading proof points

- Canonical thread IDs are assigned in `backend/services/threading_service.py`.
Expand Down
21 changes: 16 additions & 5 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ Set `DATABASE_URL` explicitly through `.env`, Docker Compose, CI secrets, or the
runtime environment. The backend has no code default for the database URL and
fails closed when it is missing.

Outbound SMTP also fails closed unless the normalized tenant SMTP host is listed
in `ALLOWED_SMTP_HOSTS` and the port is listed in `ALLOWED_SMTP_PORTS`.
Outbound SMTP/IMAP/POP3 connector destinations fail closed unless the normalized
tenant host is listed in the matching `ALLOWED_*_HOSTS` setting and the port is
listed in the matching `ALLOWED_*_PORTS` setting. The defaults allow SMTP
submission ports `465,587`, IMAP TLS port `993`, and POP3 TLS port `995`, but
operators must explicitly allow each provider hostname.

For local fixture imports, `OPENAI_API_KEY` is optional. When absent,
`import_fixtures.py` uses zero-vector embeddings so the local threading proof
Expand Down Expand Up @@ -51,11 +54,19 @@ mailbox owners.

## Warning classification

Current backend test warnings are known dependency/toolchain warnings:
Backend evidence should be collected with warnings promoted to errors whenever
the slice is under active change:

```bash
PYTHONWARNINGS=error python3 -m pytest -q
```

Historical third-party dependency warnings should be isolated or filtered with
an explicit rationale before merge evidence is accepted:

- `starlette.formparsers` imports `multipart`, which emits a pending deprecation
warning.
- Compiled SWIG metadata emits `__module__` deprecation warnings during import.

Threading code should not add new warnings. Treat any new warning from
application modules as a regression.
Threading code should not add new warnings. Treat any new application warning
or log output containing `Timeout`, `Fatal`, `Warn`, or `Denied` as a regression.
Loading
Loading