ops(archive): quota, deploy, pdf TASK/REPORT pairs verified+archived

This commit is contained in:
2026-08-29 06:03:05 -05:00
parent 23ca361025
commit 725c184511
15 changed files with 394 additions and 2 deletions
-54
View File
@@ -1,54 +0,0 @@
# 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.
-43
View File
@@ -1,43 +0,0 @@
# 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.
-48
View File
@@ -1,48 +0,0 @@
# 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.