ops(archive): TASK prompts and REPORT verifications, studies through V1
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
# TASK: Quota monitoring + back-pressure + usage mgmt + resource gate (Redmine 490+491)
|
||||
|
||||
## Context
|
||||
Charles's spec of record: `docs/SPEC-20260829-charles-brief.md` (READ IT
|
||||
FIRST, esp. "It's a marathon" + Roadmap 1). Last night the z.ai quota wall
|
||||
killed two dispatched turns at 19:00 — this system prevents that class of
|
||||
failure and maximizes the flat-rate plan 24x7 (legacy plan ends 9/22).
|
||||
Redmine tickets: 490 (quota) + 491 (resource monitor).
|
||||
|
||||
## Scope — `internal/quota` + `harness quota` + loop integration
|
||||
1. **z.ai usage polling**: research the z.ai coding-plan usage/limits
|
||||
endpoint (it exists per Charles; find the API surface from public docs
|
||||
+ the z.ai provider behavior we already see). Poll on interval; parse
|
||||
buckets/limits/reset times; expose `QuotaSnapshot` (struct: per-bucket
|
||||
used/limit/window-reset).
|
||||
- Auth via key_ref (never logged, same discipline as keyproxy).
|
||||
- If the endpoint proves unreachable/undocumented: build against a
|
||||
documented interface + fake server, flag LIVE VERIFICATION as open.
|
||||
2. **Central state decision** (Charles leaves it to us): Redis container
|
||||
vs LiteLLM-native (postgres spend tracking already live at
|
||||
192.168.3.78:4001). Decide with rationale in the REPORT; implement the
|
||||
chosen one. Requirements: multiple harness instances (9 accounts, 2
|
||||
hosts) share quota state; redis (if chosen) runs as a docker container
|
||||
on this host, config in harness.toml, no host packages.
|
||||
3. **Back-pressure in the loop** (internal/loop): before dispatching a
|
||||
turn, consult quota snapshot + schedule:
|
||||
- Peak window (config, default 0100-0500 CST — VERIFY empirically if
|
||||
possible; Charles sleeps 2300-0500): restrict to flash-tier classes;
|
||||
defer heavy classes with a logged reason; prefer LLM-lite work.
|
||||
- Quota nearly exhausted: defer + surface status; never hard-fail the
|
||||
loop.
|
||||
- Schedule + thresholds all in `[quota]` harness.toml section (TZ-aware,
|
||||
CST default).
|
||||
4. **Resource gate (ticket 491)**: read-only system monitor (load avg,
|
||||
mem available, disk free, IO delay from /proc + /sys) with
|
||||
configurable busy thresholds; loop defers dispatch when busy. cgroup
|
||||
enforcement is deploy-time — document the runbook section only.
|
||||
5. **Usage accounting**: per vertical/class token+model accounting into
|
||||
the JSONL state (extend loop state) — feeds the eventual
|
||||
per-instance Discourse usage reports.
|
||||
6. TDD red/green: quota parser, schedule logic (peak/offpeak across TZ
|
||||
edges), back-pressure decisions, resource thresholds — table-driven +
|
||||
fake clock. Docker dev discipline. Docs standard (README + config
|
||||
table). Push to origin main.
|
||||
|
||||
## Deliverable
|
||||
`REPORT-20260829-0500-quota.md` in `~/.coordinate/inbox-pmo/`: the Redis
|
||||
vs LiteLLM decision + rationale, endpoint findings, config surface, test
|
||||
results, and how the loop now behaves at quota exhaustion (the 19:00-wall
|
||||
scenario replayed as a test).
|
||||
|
||||
## ADDENDUM (redispatch, ~05:10 CST)
|
||||
- Previous attempt died on a sourcegraph.com timeout — do NOT use sourcegraph; research the z.ai usage endpoint via direct fetch of z.ai docs / the API itself.
|
||||
- BE QUOTA-LEAN (weekly bucket at 93%): minimal exploration, write code in large correct chunks, one test pass, no gold-plating, finish and report.
|
||||
@@ -0,0 +1,43 @@
|
||||
# TASK: Smart dispatcher — phase-aware model selection + queue selection (Redmine 492+493)
|
||||
|
||||
## Context
|
||||
Spec of record: docs/SPEC-20260829-charles-brief.md (Roadmap 2+3). The
|
||||
quota/back-pressure turn (internal/quota) lands in the repo BEFORE this
|
||||
turn starts — build on it, do not re-implement.
|
||||
|
||||
## Part A — Phase-aware model selection (ticket 492)
|
||||
- Routing v1: work phases get different tiers. Convention: a task's phase
|
||||
is derived v1 from explicit fields first, fallbacks second:
|
||||
1. Redmine custom field (configurable field name, e.g. "phase",
|
||||
values: plan/implement/review/grind)
|
||||
2. harness.toml `[models.phases]` map: phase -> class (plan=primary,
|
||||
implement=code, review=review, grind=flash-class default)
|
||||
3. fallback: existing class map (unchanged behavior).
|
||||
- The conductor exposes which phase it ran in the REPORT header (model +
|
||||
phase + class) — telemetry for the eventual auto-classifier (v2, NOT
|
||||
this turn).
|
||||
- Unknown phase value = config error naming valid phases.
|
||||
|
||||
## Part B — Queue selection (ticket 493)
|
||||
- Loop intake query becomes selection-aware:
|
||||
- Redmine sort: priority desc, due_date asc (config keys in
|
||||
`[redmine.selection]`); respect relations (issue blocked while
|
||||
relates/blocks parent open — use /relations or issue relations field;
|
||||
skip blocked, log reason).
|
||||
- Quota gate: consult internal/quota snapshot (from the prior turn) —
|
||||
heavy classes deferred when quota-low or peak-window per its config.
|
||||
- Resource gate: same pattern for the busy-system gate.
|
||||
- Pick order = sort order; one turn at a time (v0 concurrency), scan
|
||||
continues after each.
|
||||
- Selection decisions land in the loop JSONL (task id, chosen/deferred +
|
||||
reason) — auditable.
|
||||
|
||||
## Discipline
|
||||
TDD red/green (fake Redmine server pattern exists; add phase-routing and
|
||||
blocked-relation cases), ALL DEV IN DOCKER, docs standard (README config
|
||||
tables updated), push to origin main, NEVER broad pkill.
|
||||
|
||||
## Deliverable
|
||||
`REPORT-20260829-0700-dispatcher.md` in `~/.coordinate/inbox-pmo/`:
|
||||
phase map surface, selection rules + defer reasons, test results, how a
|
||||
priority-5 due-today ticket beats a priority-3 no-due one (test cited).
|
||||
@@ -0,0 +1,43 @@
|
||||
# TASK: Multi-account deploy — packaging + runbook, 9 accounts / 2 hosts (Redmine 494)
|
||||
|
||||
## Context
|
||||
Spec: docs/SPEC-20260829-charles-brief.md (account list inside). The PMO
|
||||
runtime CANNOT ssh or sudo — this turn produces everything so that
|
||||
deployment is a ~10-minute Charles window executing one runbook.
|
||||
|
||||
## Accounts
|
||||
- ultix-streaming: reachableceo, TSGBOD, TSGCOO, TSGCTO, TSGCCO
|
||||
- ultix-offstage (ssh reachableceo-offstage, passwordless sudo there):
|
||||
reachableceo-offstage, COSRCEO-Personal, COSRCEO-Biz, COSWFO
|
||||
|
||||
## Scope
|
||||
1. `deploy/` directory in the harness repo:
|
||||
- `deploy/accounts.tsv` — account, host, vertical, redmine project
|
||||
scope, port assignments (events/serve per account: derive a scheme,
|
||||
e.g. base port 4100+ / 8090+ offset by account index).
|
||||
- `deploy/install-account.sh <account>` — idempotent, runs AS the
|
||||
target user (no root needed if binary path is ~/.local/bin): creates
|
||||
~/.mopac/{bin,state,reports}, installs static binary (built in the
|
||||
Docker builder for linux/amd64), writes harness.toml from a template
|
||||
(per-account substitutions), refuses to overwrite existing
|
||||
harness.toml or secrets.
|
||||
- `deploy/runbook.md` — the exact Charles sequence: build once
|
||||
(docker), copy/ssh loop per host+account, run install script, start
|
||||
command per account (nohup or cron @reboot line — NO systemd claims
|
||||
without root; document both options), verify (healthz curl-equivalent
|
||||
+ first `loop --once` dry output), rollback (stop + rm ~/.mopac/bin).
|
||||
- Per-account harness.toml template with vertical/redmine-scope/ports
|
||||
substituted; secrets stay env refs (0600 env files per account,
|
||||
bootstrap instructions).
|
||||
2. Static binary build: Makefile target `release` (docker builder,
|
||||
GOOS=linux GOARCH=amd64, CGO=0) producing `bin/harness-linux-amd64`.
|
||||
3. Concurrency guard: distinct state dirs + ports per account so multiple
|
||||
daemons on one host never collide; document the account-port table.
|
||||
4. Tests where feasible (template substitution, port derivation,
|
||||
idempotence of install script in a fake HOME). Docs standard.
|
||||
|
||||
## Deliverable
|
||||
Commits pushed to ukrrs/MOPAC main (deploy/ + Makefile release target +
|
||||
README deploy section). `REPORT-20260829-0900-deploy.md` in
|
||||
`~/.coordinate/inbox-pmo/`: what Charles executes, per-host time estimate,
|
||||
verification steps, rollback.
|
||||
@@ -0,0 +1,39 @@
|
||||
# TASK: COS morning briefing — discourse client + `harness brief` (Redmine 495)
|
||||
|
||||
## Context
|
||||
Spec: docs/SPEC-20260829-charles-brief.md. Target: first live 3-COS
|
||||
briefing 2026-09-01 06:30 CST (beta 8/31 0600). Briefing = daily digest
|
||||
via Discourse (fallback Redmine note) assembled from: Redmine activity
|
||||
(scope), Gitea PR inbox, quota usage. Exact format TBD by Charles — ship
|
||||
a clean v0 format he can react to.
|
||||
|
||||
## Part A — mopac-discourse-go client (new repo)
|
||||
1. Create repo via Gitea API if absent (PMO pattern: tea token from
|
||||
~/.config/tea/config.yml, POST /api/v1/orgs/ukrrs/repos), clone to
|
||||
~/projects/meta/MOPAC/discourse-go. AGPLv3 LICENSE.
|
||||
2. Stdlib-only Go client: categories (list/create), topics (create/list),
|
||||
posts (create/update), raw JSON passthrough for anything else. API key
|
||||
via key_ref/env (never logged). Fake-server tests. Docs standard.
|
||||
(Current Discourse key 403s on category creation — client supports it,
|
||||
live verification may wait for the admin-scoped key; note in REPORT.)
|
||||
|
||||
## Part B — `harness brief` subcommand
|
||||
1. Digest window: since last briefing marker (state/brief/brief.jsonl).
|
||||
2. Sources (read-only): Redmine issues in scope created/updated/closed in
|
||||
window (reuse intake client); Gitea open PRs across ukrrs repos (API);
|
||||
quota snapshot summary (internal/quota if landed).
|
||||
3. Render: clean markdown — per-vertical sections: shipped (closed),
|
||||
moved (updated w/ status), incoming (new), PRs awaiting review, quota
|
||||
line. Beautiful tables (docs standard).
|
||||
4. Delivery v0: post to Discourse category (configurable id/slug); if
|
||||
Discourse fails (403 etc.), fallback = journal note on a configured
|
||||
Redmine "briefing" issue — NEVER silently drop; log delivery path.
|
||||
5. Scheduling v0: `harness brief` is one-shot (cron/loop calls it at
|
||||
0630); config `[brief]` section (category, redmine fallback issue,
|
||||
window tz CST). Idempotent: one briefing per window (marker).
|
||||
6. TDD (fake servers for both), docker dev, docs, push.
|
||||
|
||||
## Deliverable
|
||||
`REPORT-20260829-1100-briefing.md` in `~/.coordinate/inbox-pmo/`: client
|
||||
surface, the v0 briefing format (render a sample with fake data in the
|
||||
REPORT), delivery verification status, what Charles should tweak.
|
||||
@@ -0,0 +1,48 @@
|
||||
# TASK: mopac-pdf v0 — beautiful PDF generation pipeline (Redmine 499)
|
||||
|
||||
## Context
|
||||
Spec docs/SPEC-20260829-charles-brief.md "Workflows": beautifully
|
||||
formatted PDFs of budgets, travel itineraries, project plans, proposals,
|
||||
consulting reports, multi-year financial plans, business plans,
|
||||
engineering docs — with charts/diagrams. This feeds the COS briefing
|
||||
world (reports) and TSYS client deliverables.
|
||||
|
||||
## Constraints
|
||||
- OUR code: Go only (no python/node/rust — prebuilt engine BINARIES in
|
||||
digest-pinned docker images are tooling, fine).
|
||||
- ALL DEV IN DOCKER. AGPLv3. Docs standard.
|
||||
|
||||
## Scope
|
||||
1. New repo `ukrrs/mopac-pdf` (create via Gitea API if absent — PMO
|
||||
pattern, tea token; clone to ~/projects/meta/MOPAC/pdf). LICENSE
|
||||
AGPLv3 first commit.
|
||||
2. Engine decision (document rationale in REPORT): typst (docker image,
|
||||
typst compile) vs pandoc+latex — evaluate compile speed, chart/table
|
||||
quality, template ergonomics. Typst expected to win on modern output.
|
||||
3. Go package + CLI `mopac-pdf`:
|
||||
- Input: markdown (the composable currency of this whole stack —
|
||||
Redmine notes, Discourse posts, briefing output) + front-matter
|
||||
(title, subtitle, date, classification footer, template name).
|
||||
- Templates dir: 2 shipped v0 — "report" (clean business report:
|
||||
title page, TOC, headers/footers, page numbers) and "brief"
|
||||
(1-3 page exec summary, dense tables).
|
||||
- Charts: pure-Go rendering option (go-chart or similar permissive
|
||||
lib) embedded as images from fenced code blocks with data blocks;
|
||||
keep v0 minimal — one chart type proven end-to-end.
|
||||
- Output: PDF bytes to stdout or -o file; exit codes like harness
|
||||
(0/1/2 usage/engine).
|
||||
4. Docker runner: `mopac-pdf` shells the engine container (digest-
|
||||
pinned); host stays toolchain-free. Makefile/dev.sh per family
|
||||
pattern.
|
||||
5. Tests: template rendering golden tests (fixture .md -> PDF, assert
|
||||
non-empty + page count via a tiny Go PDF header parse or engine
|
||||
stdout), CLI flags, front-matter parsing. NEVER broad pkill.
|
||||
|
||||
## Deliverable
|
||||
Commits pushed to ukrrs/mopac-pdf main.
|
||||
`REPORT-20260829-1300-pdf.md` in `~/.coordinate/inbox-pmo/`: engine
|
||||
decision + rationale, sample outputs listed (paths), how the briefing
|
||||
pipeline will call it, what's Next (chart types, more templates).
|
||||
|
||||
> CLARIFIED (Charles): supply chain MAY include prebuilt Rust tools (typst
|
||||
> etc.) in digest-pinned images. OUR code: Go/PHP/C/Java only.
|
||||
Reference in New Issue
Block a user