32 Commits

Author SHA1 Message Date
CIAgent edf586b03a docs(P02): mark REQ-3-003 + phase 2 complete
---ci---
phase: 2
milestone: v0.3
status: complete
requirements: {covered: [REQ-3-003], partial: []}
---/ci---
v0.2.3
2026-09-12 01:41:13 +00:00
CIAgent 4439486858 chore(P02): checkpoint verify
---ci---
phase: 2
milestone: v0.3
status: verify
---/ci---
2026-09-12 01:41:08 +00:00
CIAgent b49b9189fe fix(P02): destroy kills the inner namespace init, not just the unshare shim
Verifier-found P0: UnshareBackend.destroy reaped agent → inner → helper as
asyncio subprocesses, but the inner entry is the `unshare --fork` PARENT —
its forked child (the `sleep` that is PID 1 of the sandbox pid/mnt/net ns)
reparents to host init and survives, holding the tmpfs + workspace bind for
the sleep duration (3600s). Every tracked-sandbox destroy leaked one
namespace process: ~30 orphaned `sleep 3600` observed after one suite run.
`--kill-child` does not reach the child under this flag combo (verified
empirically: the child still survives parent SIGTERM).

Fix: SIGKILL the ns-init's host pid (already tracked as `inner_pid` for
nsenter) in destroy(), after reaping the agent so it cannot flush into a
dead sandbox. Regression test creates a REAL task sandbox, asserts agent +
ns-init alive, destroys, and asserts both host pids are gone — fails on the
old code, passes with the fix. Full suite 218 green; ruff clean.

---ci---
phase: 2
milestone: v0.3
status: verify
requirements: {covered: [REQ-3-003], partial: []}
---/ci---
2026-09-12 01:39:44 +00:00
CIAgent f75352d0f0 test(P02): dropped-connection durability probe + delivery semantics docs (Wave 4)
Task 2-4-01: tests/telemetry/test_durability.py — real uvicorn ingest + real namespace
sandbox + killable TCP proxy severing the agent's WS mid-stream: every event lands
exactly once, in order, after reconnect (spool fsync + server-side (learner,task,seq)
dedup). Proxy outage is flag-driven with self-closing pumps — external socket surgery
on loop-registered sockets deadlocks the child-watcher (documented in kill()).
README: telemetry delivery semantics (at-least-once delivery, exactly-once storage,
replay path, G-3 flood boundary).

Full suite 217 green; ruff clean.

---ci---
phase: 2
milestone: v0.3
status: execute
requirements: {covered: [REQ-3-003], partial: []}
---/ci---
2026-09-12 01:18:41 +00:00
CIAgent 26b4a5be60 feat(P02): telemetry-wired sandbox spawn (Wave 3)
Task 2-3-01: create(learner_id, task_id) — telemetry sandboxes run a persistent
helper/inner namespace topology (offline inner ns; agent joins mount ns only and stays
online to reach the loopback ingest). Capture agent copied into the workspace (visible
in-ns at the bind), launched via sh -c with in-ns absolute paths (host cwd invalid after
the nsenter mount swap), stdin=DEVNULL daemonizes the agent (lifecycle tied to sandbox:
destroy reaps agent -> inner -> helper). Wire contract: frames strip URL-owned identity
(ingest extra=forbid anti-spoofing); spool keeps full events.

E2E test (real uvicorn on ephemeral port): exec in a live namespace sandbox -> events
arrive at WS ingest -> SQLite, ordered, sandbox-scoped. Pure-shell path (task_id=None)
asserts no capture agent. Full suite 216 green; ruff clean.

---ci---
phase: 2
milestone: v0.3
status: execute
requirements: {covered: [REQ-3-003], partial: []}
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent b6850fc036 feat(P02): in-sandbox capture agent + websocket ingest (Wave 2)
Task 2-2-01: sandbox-agent.py stdlib-only (D-031) — shell capture (command/file_diff/
run_result/test_result/stdin/stdout), per-task monotonic seq, JSONL fsync spool (at-least-once,
D-026), raw-socket RFC6455 client (no websockets in-namespace), exponential-backoff reconnect,
SIGKILL-safe. Loopback tests: ordered emission, spool-on-disconnect, reconnect flush order,
stdlib-only AST scan.

Task 2-2-02: WS /v1/telemetry/ingest (D-026) — query-param identity (extra=forbid frames),
server-side dedup on (learner,task,seq), gap detection + warnings, ping keepalive. G-3 flood
control: overflow or >50000 events/task -> 1008 close + trace marked INCOMPLETE_FLOODED
(terminal, Proctor signal); no silent drop. GET traces + gaps endpoints. TraceIntegrityMap
(process-local, D-019 precedent) exposes is_incomplete for the Phase 3 grader gate (G-4).

214/214 + ruff clean.

---ci---
phase: 2
milestone: v0.3
status: execute
requirements: {covered: [REQ-3-003], partial: []}
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent cfdceac17a feat(P02): telemetry models + TraceStore SQLite + TS types (Wave 1)
Task 2-1-01: TelemetryEvent (SQLModel table, composite PK learner/task/seq) + TraceSpan
derived view; SQLAlchemy @validates enforcement (sqlmodel drops Field constraints on table
models). Task 2-1-02: TraceStore protocol (D-019-mirrored) + SQLiteTraceStore with WAL +
synchronous=NORMAL (a-3); concurrent writer/reader no database-locked; idempotent
dedup-on-retry. Task 2-1-03: TS TelemetryEvent/TraceSpan mirroring Python field-for-field
(snake_case for byte-identical JSON); full typecheck green.

195/195 + typecheck pass; ruff clean.

---ci---
phase: 2
milestone: v0.3
status: execute
requirements: {covered: [REQ-3-003], partial: []}
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent f0df18576e docs(P01): mark REQ-3-001/002 + phase 1 complete
---ci---
phase: 1
milestone: v0.3
status: complete
requirements: {covered: [REQ-3-001, REQ-3-002], partial: []}
---/ci---
v0.2.2
2026-09-12 00:47:45 +00:00
CIAgent 8a3296cd21 chore(P01): checkpoint complete — phase 1 shipped as v0.2.2
---ci---
phase: 1
milestone: v0.3
status: complete
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent df4c115bb7 chore(P01): checkpoint verify
---ci---
phase: 1
milestone: v0.3
status: verify
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent 76f15622d6 verify(P01): passed — sandbox fabric verified end-to-end on this box
Four layers all PASS:
- Structural: sandbox/ AST-audited — zero imports of api/, agents/, llm/;
  manager composed only via api/deps.py DI + main.py lifespan; no docker/
  podman/sudo/containerd in the spawner path (D-024 holds).
- Behavioral: pnpm ai:test = 174/174 green; sandbox+api slice 40/40 green
  with ALL probe-gated tests RAN (zero skips) — uid=0 in-ns, 0 network
  interfaces, workspace-write lands on host, no escape into snapshots,
  /proc-remount blocked, memory/CPU/FSIZE rlimits kill violators,
  wall-clock reaper proven, G-2 size sweep destroys + preserves snapshot,
  orphan startup reaper proven, 503/403/429 paths all live-verified via
  a real uvicorn probe (curl roundtrip: 201→list→snapshot→403→429→204→404).
- Security: no secrets in sandbox/api code or logs (sk-test key in tests is
  an anti-leak assertion fixture); CORS localhost-only, no credentials;
  documented gaps (userns != DAC write-barrier; in-ns children reparent to
  host PID 1 when supervisor is killed; per-sandbox NPROC shared at host
  uid) are present in unshare_backend.py, test_resource_limits.py, README,
  and are NOT relied on — RLIMIT_NPROC is never set, disk cap is the G-2
  sweep not a kernel quota.
- Quality: pnpm ai:lint = ruff clean; pnpm ai:bootstrap idempotent (exit 0);
  all config keys env-overridable (AI_SANDBOX_*); zero cloud calls in
  sandbox/api tests (mock-first verified by grep).

Must-haves 1-8 (PLAN.md Phase 1): all SATISFIED.

---ci---
phase: 1
milestone: v0.3
status: verify
requirements:
  covered: [REQ-3-001, REQ-3-002]
  partial: []
lessons:
  - util-linux 2.38 lacks unshare --bind; the in-namespace mount shim is the
    correct swap — keep the rlimit-on-payload-only ordering (bind, then
    ulimit, then exec) so unshare/mount stay unconstrained.
  - tmp_path under /tmp breaks the backend (in-ns tmpfs shadows host /tmp);
    repo-anchored tests/sandboxes/ is the load-bearing fixture choice.
  - pnpm on this box needs 'corepack enable' before turbo can resolve the
    package-manager binary; bootstrap env setup, not a repo defect.
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent b01de4be7d feat(P01): sandboxes lifecycle API + G-5 abuse control (Wave 3)
Task 1-3-01: /v1/sandboxes endpoints (create/list/get/snapshot/delete) over the manager
singleton via DI; lifespan boots the startup orphan reaper (a-1) + destroys all on shutdown.
Abuse control (G-5): learner allowlist (403 unknown id), per-learner active cap (429),
global create-rate cap (429). CORS gains DELETE. 174 full-suite tests green; manual probe
POST /v1/sandboxes -> 201 verified live; ruff clean.

---ci---
phase: 1
milestone: v0.3
status: execute
requirements: {covered: [REQ-3-001, REQ-3-002], partial: []}
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent d1b933621b feat(P01): sandbox manager + resource-limit enforcement (Wave 2)
Task 1-2-01: SandboxManager — pool-full guard (503/D-032), create/list/get/snapshot/destroy,
reap_expired + workdir-size sweep (G-2 512MB), startup orphan reaper (a-1). In-memory
process-local registry (D-019 precedent). config.py gains the sandbox knobs.

Task 1-2-02: probe-guarded enforcement tests — all RAN green on this box (3.1s):
memory MemoryError kill, CPU SIGKILL at budget, RLIMIT_FSIZE truncation, wall-clock reaper,
NPROC shared-at-host-uid statically asserted (no fork-bomb per G-1). Documented honest
limitation: killing the supervisor does not kill in-namespace children (re-parent to host
PID 1); disclosed for the P7 release note.

155 full-suite tests green; real-UnshareBackend smoke runs on this box; ruff clean.

---ci---
phase: 1
milestone: v0.3
status: execute
requirements: {covered: [REQ-3-001, REQ-3-002], partial: []}
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent 2d9f3201b3 feat(P01): sandbox backend + workdir + deps + config (Wave 1)
Task 1-1-01: SandboxBackend protocol + UnshareBackend (unshare user/mount/pid/net)
+ workdir layout (workspace/ + snapshots/). Isolation probe real on this box:
in-ns uid=0, network isolated (fresh net ns, lo only), writes contained to per-sandbox
bind dir; proc-remount not permitted (documented, not required). Deviations (documented):
util-linux 2.38.1 lacks --bind flag -> bind moved into namespace via sh -c mount shim;
rlimits moved into shim (preexec would kill the pytest interpreter); userns != DAC barrier
(host-uid-owned targets), documented for hardening under D-025.

Task 1-1-02: add sqlmodel, sqlalchemy, websockets, aiofiles (PyPI-verified); config keys
SANDBOX_DIR/MAX_CONCURRENT=5/TIMEOUT_S=900/MAX_WORKDIR_MB=512/DB_PATH (D-024/027/032/G-2).

Task 1-1-03: README sandbox isolation section with real probe transcript + locked
resource-limit mechanism (G-1/G-2); ruff config already correct (no change).

139/139 tests pass; ruff clean. .gitignore: ignore all ai-service sandboxes dirs (runtime+tests).

---ci---
phase: 1
milestone: v0.3
status: execute
requirements: {covered: [REQ-3-001, REQ-3-002], partial: []}
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent 45b2162bec chore(P00): checkpoint complete — phase 0 shipped as v0.2.1
---ci---
phase: 0
milestone: v0.3
status: complete
---/ci---
v0.2.1
2026-09-12 00:47:45 +00:00
CIAgent d8fb56fb56 chore(P00): checkpoint mvp_ux_check 2026-09-12 00:47:45 +00:00
CIAgent a5b8be2e4d decision(P00): mvp/ux gate — verified present
PLAN.md contains all three mandatory sections with substantive content (post-GRILL CUT-2 wording):
- ## User-Facing Surface (learner build + defend flow; /build run/test+output panel, /defend live defense+grading)
- ## Happy Path (9-step end-to-end: variant -> sandbox build -> run/test telemetry -> defense -> grading -> verdict)
- ## UX Acceptance Criteria (10 criteria incl. no-mock-in-learner-path, 503 busy state, error/retry, build+typecheck+tests green)
Gate PASSES — EXECUTE unblocked. KYC deferred (A-110); voice mock+browser (CUT-1); run/test build panel (CUT-2).

---ci---
phase: 0
milestone: v0.3
status: mvp_ux_check
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent 18b9ceda93 chore(P00): checkpoint grill 2026-09-12 00:47:45 +00:00
CIAgent 0131da5b0d docs(P00): grill verdict — GO-WITH-CHANGES, binding decisions + scope cuts applied
G-1 resource-limit claims match mechanism (mem/cpu/fsize/wallclock kernel-enforced;
  per-sandbox pids + hard disk quota documented as accepted v0.3 gap, no cgroup/sudo)
G-2 disk cap via manager workdir-size sweep (AI_SANDBOX_MAX_WORKDIR_MB, default 512MB)
G-3 telemetry flood control: WS 1008 + INCOMPLETE_FLOODED trace (no silent drop-oldest)
G-4 grader refuses gapped/incomplete traces (UNGRADABLE_TRACE_INCOMPLETE verdict)
G-5 no-auth abuse control: per-learner caps + learner allowlist (ships despite KYC defer)
G-6 release note discloses partial resource enforcement (P7 honesty)
CUT-1 real server STT/TTS deferred to v0.4 (voice mock+browser-first)
CUT-2 interactive xterm shell relay deferred to v0.4 (build panel = run/test + output)
Advisories a-1..a-5 applied (startup reaper, RLIMIT_FSIZE, SQLite WAL, digest-gaming
  prompt note, variant fairness envelope)

---ci---
phase: 0
milestone: v0.3
status: grill
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent 717c46aadc chore(P00): checkpoint plan 2026-09-12 00:47:45 +00:00
CIAgent 044e4b8cc8 docs(P00): create phase plans — v0.3 credential engines
Vertical-slice plan: 6 execution phases, 20 waves, 39 tasks.
P1 sandbox fabric (unshare namespaces, D-024/032) · P2 telemetry (WS+SQLite, D-026/027)
P3 trace grading (digest+LLM, D-028) · P4 variants (seeded templates, D-029)
P5 voice defense (VoiceProvider, Examiner, D-030) · P6 re-grounding + learner integration.
MVP/UX sections included (User-Facing Surface, Happy Path, UX Acceptance Criteria).
Must-haves per phase; KYC deferred (A-110); mock-first voice (no blocking key).

---ci---
phase: 0
milestone: v0.3
status: plan
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent ec897336a5 chore(P00): checkpoint research 2026-09-12 00:47:45 +00:00
CIAgent 6be95cf2f6 docs(P00): research findings — credential engine architecture + personas
ARCHITECTURE.md:
- D-024 sandbox isolation via unshare Linux user/mount/pid/net namespaces
  (probe-verified: in-ns uid=0, network isolated, no container runtime/sudo on box)
- D-025 sandbox scope = coding IDE only (design/sim deferred to v0.4)
- D-026 telemetry = WebSocket ingest + SQLite ordered event log (seq gap detection)
- D-027 first persistence = SQLite, protocol-wrapped stores (Trace/Grade/Variant/Defense)
- D-028 trace grading = deterministic digest features + LLM rubric (LLM never sees raw trace)
- D-029 variant generation = seeded template instantiation, seed persisted
- D-030 voice = provider-agnostic mock-first STT/TTS + browser fallback (D-014 mirror)
- D-031 extend ai-service (no new apps); D-032 single-box 1-5 concurrent sandboxes
- New engine component tables + v0.3 build order

PERSONAS.md (lead-developer assessment):
- new sandbox-engineer + voice-engineer custom personas (phase-specific)
- backend-engineer territory extended to engine persistence/APIs; ai-engineer re-scoped
  to model-facing grading/variant/voice logic; security-auditor stays inactive (KYC deferred)

A-101 corrected post-probe: bwrap absent -> unshare namespaces (verified)

.gitignore: ignore SQLite data + sandbox runtime dirs

---ci---
phase: 0
milestone: v0.3
status: research
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent da9320bf4e docs(P00): clarify v0.3 ambiguities — auto-resolved (full autonomy)
A-101 bwrap user-namespace sandbox isolation; A-102 coding-IDE-only scope (design/sim deferred);
A-103 xterm.js+WebSocket build UX; A-104 WebSocket+SQLite telemetry transport; A-105 SQLite trace store;
A-106 LLM trace grader w/ code-computed deterministic features; A-107 seeded LLM variant generation;
A-108 provider-agnostic mock-first voice (STT/TTS); A-109 Examiner agent reuses BaseAgent+SSE;
A-110 KYC/age-gating deferred per founder directive; A-111 extend ai-service (no new apps);
A-112 single-box 1-5 concurrent sandbox capacity target.

All resolutions confidence >= 0.60.

---ci---
phase: 0
milestone: v0.3
status: clarify
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent 01286a02cb docs(init): validate specification — milestone v0.3 credential-engines
- config.json: milestone v0.3 credential-engines, branch milestone/v0.3-credential-engines
- PROJECT.md: v0.3 scope sandbox fabric, telemetry, trace grading, variant gen, voice defense;
  REQ-F-017 (identity/age-gating) explicitly deferred per founder directive
- REQUIREMENTS.md: activate REQ-F-007/008/009/010/021 as REQ-3-001..008; REQ-F-017 re-deferred to v0.4+
- ROADMAP.md: v0.3 phase structure P0-P7
- .gitignore: ignore .ciagent/bin/ (local credential helper)
- Clear stale v0.2 CHECKPOINT.json (milestone complete; new run starts at SPECIFY)

---ci---
phase: 0
milestone: v0.3
status: specify
---/ci---
2026-09-12 00:47:45 +00:00
CIAgent c4a083387a chore: forge migration git.cloudinit.dev -> git.coreci.dev
---ci---
phase: 7
milestone: v0.2
status: complete
---/ci---

Forge hard-cutover verified: old host TLS-dead, new host serving
repo with full history; coreci-bot token valid (push+admin);
all 12 releases migrated with IDs intact (#847-#864, v0.0.1-v0.2.2).

- config.json: release.base_url -> https://git.coreci.dev
- PROJECT.md: D-006 decision row records the migration
- origin remote URL updated (git remote set-url)
- local credential helper (.ciagent/bin, gitignored) now matches
  both hosts — new primary + legacy for older checkouts
2026-09-12 00:45:24 +00:00
CIAgent 3780537b5a chore(P07): checkpoint complete — milestone v0.2 done
---ci---
phase: 7
milestone: v0.2
status: complete
---/ci---
2026-09-11 17:35:46 +00:00
CIAgent 88a1dab810 docs(milestone): complete v0.2-ai-tutor-architecture
---ci---
phase: 7
milestone: v0.2
status: complete
requirements:
  covered: [REQ-2-001, REQ-2-002, REQ-2-003, REQ-2-004, REQ-2-005, REQ-2-006, REQ-2-007, REQ-2-008, REQ-2-009, REQ-2-010, REQ-2-011, REQ-2-012]
  partial: []
---/ci---

Milestone v0.2 (ai-tutor-architecture) merged to main.

Escalation record (audit remediation, durable): P1 executor
delegation failed twice (empty subagent results, zero files
created); auto-resolved at full autonomy to inline execution with
identical plan fidelity (commit 3271373, reflog-only after phase
branch squash-delete).
v0.2.0
2026-09-11 17:34:50 +00:00
CIAgent 71728e35c8 chore(P07): audit fixes — roadmap phase 7 complete, clean remote URL
---ci---
phase: 7
milestone: v0.1
status: complete
---/ci---

Audit fixes:
- ROADMAP.md: phase 7 status corrected from in_progress to complete
- Remote origin URL: removed embedded token (security)
- Deleted stale remote milestone branch
2026-09-11 13:53:18 +00:00
CIAgent daa0463a97 chore: pre-approve esbuild and core-js-pure build scripts
---ci---
phase: 7
milestone: v0.1
status: complete
---/ci---
2026-09-11 13:07:15 +00:00
CIAgent 810485ecc8 docs(milestone): complete v0.1-nextcraft-ui-prototype
---ci---
phase: 7
milestone: v0.1
status: complete
requirements:
  covered: [REQ-001, REQ-002, REQ-003, REQ-004, REQ-005, REQ-006, REQ-007, REQ-008, REQ-009, REQ-010, REQ-011, REQ-012, REQ-013, REQ-014, REQ-015, REQ-016, REQ-017, REQ-018, REQ-019, REQ-020, REQ-021, REQ-022, REQ-023, REQ-024, REQ-025, REQ-026, REQ-027, REQ-028]
  partial: []
---/ci---

Milestone v0.1 (nextcraft-ui-prototype) complete.

Summary:
- 7 phases (P0 pre-execution + P1-P6 execution + P7 final review)
- 28 requirements covered (all complete)
- 4 surfaces: Learner (7 pages), Marketplace (5), Employer Dashboard (4), Admin (4)
- 19 routes, 104 TypeScript files
- Shared component library (5 primitives + design tokens)
- Mock data: 5 competency stacks (70 competencies), 20 jobs, 15 candidates, 10 employers
- Tech: Next.js 15, Tailwind CSS v4, lucide-react, recharts, @xyflow/react, Inter font
- Storybook with 6 stories
- Dark mode, breadcrumbs, role switcher, responsive design
- Build passes, typecheck passes, Storybook build passes

Phases:
  P0 pre-execution     → v0.0.1
  P1 project-scaffolding → v0.0.2
  P2 learner-surface   → v0.0.3
  P3 marketplace-surface → v0.0.4
  P4 employer-dashboard → v0.0.5
  P5 admin-surface     → v0.0.6
  P6 polish-integration → v0.0.7
  P7 final-review-ship → v0.1.0 (milestone release)
v0.1.0
2026-09-10 22:47:56 +00:00
CIAgent 6ee51f61f0 chore: initialize repository
Initial repository setup for Nextcraft — AI-native outcome school + marketplace.

---ci---
phase: 0
milestone: v0.1
status: specify
---/ci---
2026-09-10 21:23:47 +00:00