gitoria

kunibert

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitcdfa94a9cdfa94a9Records: AppArmor profile for the review sandboxmrecdfa94a9/docs/DESIGN.md

7.6 KB

  1. # Kunibert design (draft 2026-11-01, unconfirmed; NOT HIS unless quoted)
  2. Sources: docs/konrad-handover/ (Vinzenz), gitoria reports E38 and E38b, /media/STORAGE/projects/hybriel/docs/HL-PRIMER.md.
  3. ## 1. What it reviews
  4. - Every PR on a gitoria repo whose owner connected Kunibert. It reviews the PR's current head, with the diff taken locally as merge-base(base, head)..head.
  5. - Three separate axes, as in Konrad: **correctness** (bugs, security, data loss, edge cases, tests), **spec** (against the linked tickets: description plus comments oldest first, where a later comment overrules), **standards** (the repo's documented rules, e.g. AGENTS.md/CLAUDE.md, cited by file and words).
  6. - From day one, Kunibert also gets the improvements Konrad still lacks:
  7. - a category checklist in the prompt (caching, backfill, timeouts, deploy order, contracts);
  8. - a stricter spec axis ("move to a separate PR" is never a finding);
  9. - a per-repo memory of accepted decisions;
  10. - failures go to the operator, never as a PR comment.
  11. - Gates (lint, typecheck, tests in a prepared workspace) come in v2, as their own ticket.
  12. ## 2. How it gets PRs
  13. - Through gitoria's push API (gitoria#38, Option B plus the E38b additions), once it is built. The repo owner connects Kunibert. Gitoria then sends one HMAC-signed POST per event: PR opened, reopened or ready; new commits (incl. force-push); review re-requested; a reply in a Kunibert thread; `@kunibert reset` or `@kunibert <text>`; thread resolved; closed or merged.
  14. - Kunibert answers each POST at once and puts the job in a queue. There is one job per PR, and a newer event updates the queued job instead of adding a second one.
  15. - Code: `git fetch` over HTTPS with the app token, into a bare cache with forced refspecs (PR head and base). No diff API.
  16. - Linked tickets: gitoria names them, and Kunibert reads them directly with its own read-only tickets token. That is Vinzenz's advice and my lean; **caramboleyo decides**.
  17. - On start, Kunibert polls the PR list once, so lost events do no harm.
  18. ## 3. How it reports
  19. - One review per run: a verdict (approve / comment / request_changes), a body and inline comments on new-side lines in the diff. Findings outside the diff go into the body under "Not on changed lines".
  20. - The comment format follows Konrad: badge, severity, axis and title. The header counts both new and still-open threads ("0 new, 1 still open").
  21. - Replies and resolves happen in Kunibert's own threads. The status per head sha goes pending → success, or failure on request_changes.
  22. - Kunibert never merges. Merging stays with caramboleyo.
  23. - Memory: one model session per PR, resumed on every wake-up with only the delta, following Konrad's memory rules (settled threads are never raised again). Settled keys and seen-watermarks are stored in Kunibert's own data, and a generation counter guards against a reset during a run.
  24. ## 4. Which model
  25. - DECIDED 2026-11-02 (Vinzenz, 4-apps-api-review.md point 25): codex gpt-6.1-sol, effort max, output schema, read-only sandbox, own unix user.
  26. - Proposal: the same one as Konrad, codex `gpt-6.1-sol` at reasoning effort max, with the output schema and a read-only sandbox under its own unix user. It has a measured record: 74 % of findings valid, 2 min median (vs CodeRabbit 59 %, 8 min). The quota comes from Apollo's Sol budget. Claude is the alternative. **Apollo/caramboleyo decide** (cost question to Vinzenz pending).
  27. ## 5. How it is built
  28. - A Hybriel service (his words: "build a similar tool with gitoria and hybriel"). It uses:
  29. - hl:web for the hook route and a small status page;
  30. - hl:proc `run`/`spawn` for git and codex;
  31. - hl:fetch for the back-channel and tickets;
  32. - an hl:data table for jobs and memory;
  33. - hl:time timers for the queue.
  34. - Known framework gaps (E38 section 6): HMAC-SHA256 is not documented, and a task cannot be detached from a request (the workaround is a timer tick that reads the queue). These are gitoria's gaps too. They go to Arachne/Anton via Apollo; Kunibert builds no workaround.
  35. - Host, port and domain: not decided. They follow the WorldAPI scheme and need Apollo's GO.
  36. ## 6. Plan (one ticket each; build only after Apollo's GO)
  37. 1. Event intake: hook route, HMAC check, delivery-id dedupe, job queue.
  38. 2. Git cache and local diff (forced fetch, merge-base, delta limited to the PR's files).
  39. 3. Model runner and schema (prompt in a file, errors from the JSON events, operator alert).
  40. 4. Posting the review, threads, replies, resolves and status to gitoria.
  41. 5. Per-PR session memory (resume, delta, settled keys, generation counter, `@kunibert reset`).
  42. 6. v2: a gate lane (prepared workspace, lint/typecheck/tests as facts in the prompt).
  43. - Tickets 1, 2 and 4 depend on gitoria#38 being built. Ticket 3 and parts of 5 can start against a local fake repo.
  44. - Proof for each step: a PR pushed to a test repo on gitoria → event → review visible on that PR.
  45. ## 7. Vinzenz's answers (2026-11-01, report from Vinzenz; folded into the plan)
  46. - **Model:** keep codex gpt-6.1-sol at effort max (Claude opus would work too; quality comes from prompt + memory + schema). There is no per-review $ figure: Konrad runs on a subscription, about 3 % of a weekly quota in a week of light use. → Log `usage` from codex --json per job from day one. Time: median 1.7 min, up to ~10 min on big PRs, hard timeout 15 min (SIGKILL).
  47. - **Runner:**
  48. - `codex exec --json -s read-only --skip-git-repo-check -C <dir> --output-schema <file>` via `sudo -n -H -u <runner user>`, so the model cannot read the app key.
  49. - stdin must be closed or /dev/null, because resume hangs otherwise. Prompts over ~16 KB go to a file.
  50. - Resume: `codex exec resume --json -c sandbox_mode="read-only" <session> <prompt>` (no `-s`).
  51. - Errors: take the last error event from stdout.
  52. - The runner user's ~/.codex must be writable for token refresh. Pin model and effort in its config.toml.
  53. - **Gates:** v2, but design for them now: a `gates` field in the result and a slot for gate output in the prompt.
  54. - **Checklist for the prompt:**
  55. - cache invalidation;
  56. - backfill when constraints are added;
  57. - publish/draft side effects;
  58. - timeouts split by purpose;
  59. - time limits and recovery;
  60. - stale async responses in the UI;
  61. - CLI argument validation and hard-coded developer paths;
  62. - whether README/ARCHITECTURE claims still hold;
  63. - a11y/i18n;
  64. - N+1 queries and unbounded loops;
  65. - cross-repo deploy order (backward compatibility or a "DEPLOY AFTER" note, and check the sibling's reader).
  66. - **Spec axis** (33 of Konrad's 38 false alarms were here):
  67. - "split it out" is a nit or summary-only;
  68. - read the PR description and linked/stacked PRs before calling a requirement missing;
  69. - the newest ticket comment overrides;
  70. - a cited exception is not raised again ("withdrawn");
  71. - "won't fix, by design" is kept per repo.
  72. - More detail: Vinzenz's CR-vs-Konrad report (ask Markus if needed).
  73. ## 8. Gitoria's answers (2026-11-01, report from Gitoria) — OUTDATED
  74. Superseded 2026-11-02: contract /media/STORAGE/projects/WorldAPI/gitoria.worldapi.org/docs/apps-api.md (v1.1+), PR number decided (gitoria#40), linked tickets decided (Kunibert reads them with its own token), test repo kunibert-test exists. Vinzenz's review of the contract and of this design: docs/konrad-handover/4-apps-api-review.md (final unless caramboleyo says otherwise).
  75. - The push API is not being built yet. It needs Apollo's GO for gitoria and caramboleyo's yes on Option B plus the E38b additions (~20 steps). No ETA.
  76. - PR id: the plan is a stable per-repo number (#1, #2…, never reused; E38 question 19, still open). Today the id is the |||PR commit sha, which changes on rewrite. → Kunibert designs against the number.
  77. - Linked tickets: not decided.
  78. - Test repo: none. Making one is caramboleyo's call. Gitoria will ask on gitoria#38 when its build gets GO.

Branches

Latest commits

  • cdfa94a9Records: AppArmor profile for the review sandboxmre
  • c1bf02d8Status: sandbox blockermre
  • 88aaacc5Records: real proof part 2 (posting works, sandbox blocked by AppArmor userns)mre
  • 401df4e8Records: review user logged inmre
  • 6ca681b3Records: login command, status cleanupmre
  • 6b8d763cRecords: review user, device login startedKunibert
  • 07025b99Open the job worktree read-only for the review user before each model runKunibert
  • 2a44bd54Runner CLI: --review-user/--codex-bin/--work-dir work in every modeKunibert
  • 2177f66fReview model runs as its own unix user (reviewUser, codexBin, workDir)Kunibert
  • 35df8306Records: live service on byrodin, real proof part 1Kunibert
  • 7480a98dkunibert.service: SIGTERM stop is a clean exitKunibert
  • 3a8d93f9gitoria client: parse only JSON answers, accept a plain-text errorKunibert
  • c9b48bfeVendor Hybriel plugins; deploy ships bin/ from zig-outKunibert
  • a41ba15fKunibert: event intake, git cache, review runner, posting, linked tickets, deploy filesKunibert