kunibert
All repositories: gitoria
5.9 KB
# Mission K6: posting to gitoria (kunibert#6, step 4)Task (his words, kunibert#1): "basically we want [the consultant] now to build a similar tool with gitoria and hybriel."This step only: after a review run, Kunibert writes the result back to the PR through gitoria's back-channel and reads thread updates from it. Gitoria's API is not live yet; build against its written contract and test against a small FAKE gitoria you run locally. No real gitoria, no tickets, no real codex.## Read first- The contract v1: /media/STORAGE/projects/WorldAPI/gitoria.worldapi.org/docs/apps-api.md (sections 0, 2, 3, 5, 6 and the changelog). [OPEN] names: keep them in ONE place.- /media/STORAGE/projects/kunibert/docs/reviewer-design/3-output-schema.md (comment format: badges, "N new, M still open" headers, "Not on changed lines", thread keys) and 1-design-and-lessons.md ("failures go to the operator, never as a PR comment").- /media/STORAGE/projects/kunibert/docs/DESIGN.md sections 3, 7; reports/K2-runner.md, K3-memory.md, K4-gitcache.md (what exists: `review-pr`, lib/gitcache.hl, lib/review-memory.hl threads T<n> and watermarks).- /media/STORAGE/projects/hybriel/docs/HL-PRIMER.md, docs/CODE-ORDER.md; hl:fetch (plugins/fetch, its doc page under /media/STORAGE/projects/hybriel/projects/homepage/generated/pages/), hl:fs, hl:crypto.Copy working shapes from the docs. Not covered → DOCS line; framework gap → GAP line with a minimal repro, no workaround. Hybriel .hl only in lib/ and tools/ (Python allowed only for the fake server and test scripts in scratch).## Do not touchAnother worker is building service/, lib/intake.hl, lib/queue.hl, lib/gitoria-events.hl (event intake). Don't edit those. You may change lib/runner.hl, tools/runner.hl, lib/review-memory.hl, and add new lib files (e.g. lib/gitoria-api.hl, lib/review-post.hl).## Build1. **Client** lib/gitoria-api.hl: `{api}` comes from config, never built. App key from a key file (mode 600, path argument; tests: scratch). Token via `POST {api}/apps/token`, cached in memory/data until shortly before `expires`; on 401 fetch a new token once and retry. 429 → wait Retry-After (capped) and retry; other errors → structured error. Never log the key, the token or Authorization headers. The token also feeds lib/gitcache.hl's fetch (pass the token, not a file, or write it to a 600 temp file that is removed: your choice, say which).2. **review-pr against gitoria**: `tools/runner.hl review-pr <data> --api <url> --key-file <f> <pr-number>`: `GET pulls/N` gives clone URL? (no: clone comes from the event's repo.clone; take it as an argument `--clone <url>` too) target, head, mergeBase; then fetch (step 2 code), threads from `GET pulls/N/threads` (all pages) replace the local --threads file: new comments = `seq` above the stored watermark (switch the watermark from comment id to `comment.seq`), resolved flips; keep the old local mode working.3. **Status**: `PUT statuses/<head>` context `kunibert`: `pending` at start; at the end `success` (approve/comment) or `failure` (request_changes); `error` when the run failed (summary short, no stack, no secrets; full error to stderr / operator log).4. **Review**: one `POST pulls/N/reviews` with head, verdict, body and inline comments in the earlier reviewer's format (badge, severity, axis, title, then body; header counts "N new, M still open" per axis; findings off the diff under "Not on changed lines"). Before sending, check each inline line against the local `git diff -M -U3 <merge-base> <head>` (new-side lines inside hunks, new-side path) and move misses to the body. If gitoria still answers 422 with details, move those comments to the body and send once more. 409 stale_head → do not post, status untouched, return `{"skipped":"stale_head"}` (a newer event will come). Max 100 inline; the rest into the body. Body ≤ 20,000 chars (truncate with a note).5. **Thread ids**: store gitoria's thread id for each new T<n> from the review answer (match by index/path/line). Replies from the model (`replies` in schema.json: key, body, resolve) → `POST threads/:id/replies`, and resolve:true → `POST threads/:id/resolve {"resolved":true}`.6. Skips (same head, nothing new) post nothing.## Proof (fake codex only; saved outputs in /media/STORAGE/claude-scratch/kunibert/K2, K3, K4)A fake gitoria in scratch (Python http.server on 127.0.0.1, port in 8840–8859, check `ss -ltn`) implementing the v1 routes you use, keeping every request in a log, with switches to answer 401 once, 429 once, 422 for one line, 409. It serves the git refs from a local bare repo (the fetch may use file:// in the test; say so).- First run → status pending, then one review with the inline comment on the right path/line, then status failure (request_changes); state has gitoria's thread id for T1.- Fake adds a human reply (seq above watermark) and a new commit; second run → the reply reached the prompt, the model's reply + resolve were posted to that thread id, status success.- A finding on a line outside the diff → in the body, not inline. A forced 422 → resend without that comment, it shows in the body.- 409 stale_head → nothing posted, skipped. 401 once → new token, success. 429 → waits and retries.- Fake codex failing → status `error`, no PR comment.- Grep the fake's log and all Kunibert logs/outputs: the key and token values never appear outside the Authorization header the fake received.- K4's proof.py still passes (run it: python3 -I /media/STORAGE/claude-scratch/kunibert/K4/proof.py).Stop the fake server at the end by its PID.## LimitsAbout 60 tool calls. No real codex, no sudo, no network outside localhost, no commits, no tickets, no messages to others. Scratch only under /media/STORAGE/claude-scratch/kunibert/K6/.Runtime: /media/STORAGE/projects/hybriel/native/zig-out/bin/hybriel, launched from /media/STORAGE/projects/kunibert.Report: /media/STORAGE/projects/kunibert/reports/K6-posting.md (files, exact commands, proof output, DOCS/GAP lines, open points). Stop when done or blocked.
Branches
Latest commits
- bd3591c7conductor: gates run on the live day44 binarymre
- 47f747a7records: jukebox #9 fix livemre
- 0a3169fdMerge branch 'vendored-size' into mainKunibert
- e447bb09Vendored size fix: keep renames with an app side whole; type the filter parameter (L10)mre
- 99ccc742Vendored size fix: no renames in the app diff, filter the resumed delta toomre
- 1a52e100|||PR Diff size limit counts only app files when vendored paths are setmre
- 50a1867estatus: jukebox #9mre
- c57484e6log: jukebox #9 diff sizemre
- 795a20carecords: guard fix live (PR 8)mre
- 6981d96fMerge branch 'fresh-on-nocmd' into mainKunibert
- 37c47840runner: one shared prompt for both fresh-session fallbacks (L16)mre
- f945d2e1|||PR runner: a resumed run with no command on a new head gets one fresh session instead of a tool errormre
- 10b2a49estatus: PR 314, guard fix proposedmre
- e73995a3log: hycon PR 314 approved after fresh reviewmre
- f60427falog: hycon PR 314 false tool errormre
- 481974f7log: Hermes accepts PR 259 findingmre
- bb0976acrecords: hycon PR 259 design findingmre
- 5c637c24records: hycon PR 259 false tool errormre
- a344c406log: routger 132 reviewedmre
- 56e70dcbrecords: review time limit 1800 s (routger 132)mre