Skip to content

epic: workspace read contracts for behold's default view (runs, waves, events, drift, change sets, metrics, alerts) #3990

Open

Description

@lex00

behold is moving its kiosk view (the live demo at https://demo.intentius.io/kiosk, INTENTIUS/behold#571) to its default view for any estate: the graph, plus what's happening across the estate mixed together (runs and logs, gates and the ledger, alerts, metrics), across every substrate a chant project spans.

The maintainer's rule: chant workspace read contracts are the interface. Workspace grows to cover what the view needs, and behold reads through the contracts, never around them. The chant/lifecycle git ledger is the default backend, sized for a software factory or simple setups. A higher-volume backend can sit behind the same contracts. Raw CI logs and OTel metric series stay on the forge API and a metrics endpoint.

What behold can already read: workspace status <env> --json (gates, releases, stewards and each Op's last run, in-flight, leases, open points), workspace points, workspace runs (agent runs with tokens and cost), workspace ls, workspace graph, and gate-audit over _gates/.

Gaps

Each is marked as a contract (a shape behold reads) or a backend (where the data lives).

  • contract field: OpRunRecord carries its CI run (forge, id, url), as GateRunLocator does for pending gates (op/runtime.ts:116-162; op/gate-run-locator.ts).
  • contract: Op run and wave-run history across members and envs, --json --since <cursor>, alongside workspace runs (agent runs). Today chant run list/status/log print text only, and the run ledger reads git directly instead of through LedgerReadPort (lifecycle/run-ledger.ts:41).
  • contract: a persisted wave-run record per Op waves job: waiting, applying, applied, refused, failed, with timestamps and run link. RunOpWaveResult is printed, never kept (op/op-waves-run.ts:617-640).
  • contract and backend: chant.notify/v1 events also appended to the ledger and read with workspace events --since; id already deduplicates them. Today they are push-only to webhook, Slack and Teams (notify.ts:228-244).
  • sender: core sends drift. WatchOp records structured findings from lifecycle diff --live --json instead of a boolean scraped from text headers (op/activities/lifecycle.ts:83-101).
  • backend: in-flight run state visible off the executing host. Today it is <git-common-dir>/chant/runs/*.json, deleted on settle (op/run-live.ts:1-24), so CI and remote runs are invisible until they finish.
  • backend: change-set documents stored by digest, so the plan an approval binds can be read after the step ends. Today only the digest reaches the ledger.
  • backend: a higher-volume store behind LedgerReadPort and the contracts: append-only, opaque cursors, per-kind retention, query by member, op, kind and time. The git branch stays the default.
  • contract: delivery and agent metric names and labels for products to emit (stage duration, apply seconds, lock wait, wave waiting since, drift since, DORA), aligned with the otel lexicon's semantic conventions and the GenAI and agent metrics work (epic: GenAI metrics under the semantic conventions across otel, prometheus and grafana #3039, otel: agent, tool, workflow, cache, reasoning and MCP metrics from semantic-conventions-genai #3044). Only low-rate facts (last apply duration, waiting since, drift since) belong in a workspace contract; series stay on the metrics endpoint.
  • contract: alerts declared by a project's prometheus lexicon (rule groups, Alertmanager routes) resolvable to their live state through a read behold can make, so behold's alerts strip shows the project's own alerts.

Related: #2524 (workspace research), #3378 (otel and prometheus toward an aws-grade lexicon), #3039, #3044, #3761 (notify), #3616 (gates in workspace status), #2481 (CLI start-up time, which matters for a polling view).

🤖 Generated with Claude Code

Activity

  1. lex00 commented on Oct 16, 2026

    @lex00
    ContributorAuthor

    From INTENTIUS/behold#631 (the kiosk's Components view for a repo that runs chant's pull-request loop): what behold reads today, and the read contracts it would read through instead.

    Read now:

    • components and waves: chant graph --components --format ir (groups.byWave, each component's attrs.liveNames);
    • each stage's result: pr-report/v1 (pr-report.schema.json) when it is in the served checkout's --output dir; in CI it stays in the job, so behold parses the summary pr-plan: / pr-apply: prints at the end of the step (handlers/pr.ts printMembers and the plan :, approve :, applied the plan ... approved by lines) from the run logs it already copies;
    • the gate: _gates/pr-<n>.jsonl on chant/lifecycle through @intentius/chant/lifecycle/gate-audit (gateLedgerLinesFromLog, deriveGateAudit);
    • the loop itself (env, gate, output dir): the chant components pr-plan|pr-apply lines in the generated workflow file.

    Missing contracts:

    • contract: a workspace read of a pull request's reports, pr-plan and pr-apply (pr-report/v1), keyed by op and commit, with the change set the digest binds. Backend: chant#4007's --report-url, or the ledger beside _gates/.
    • contract: progress per wave and component while pr-apply runs (chant#4007's RunProgressEvents), kept where a reader outside the job reads them. Same shape as the epic's wave-run record.
    • contract: a gate read for a project that is not a workspace: today workspace status --json carries gates only inside a workspace, so a single project's pr-<n> gate is read through the gate-audit library, not a CLI contract.
    • contract field: the generated pipeline (chant build --components --generate <forge> --format json) names its pull-request loop: stages, env, gate and --output, so a reader does not parse the workflow text.
  2. lex00 commented on Oct 17, 2026

    @lex00
    ContributorAuthor

    Run history: #4019 adds the run-event contract (run-event.schema.json, contract 1, chant 0.124.28 and newer). It is one stream for Op, component and pipeline runs, with runId, gitSha, runtime and runOrigin on every event, and its types and writer are exported from @intentius/chant. The emitters are #4041; replay and --follow are #4042, which still waits on this issue's off-host in-flight state.

  3. lex00 commented on Oct 17, 2026

    @lex00
    ContributorAuthor

    CI locator: #4020 covers it. An Op run record now carries runOrigin, the same RunOrigin shape deploy records use (forge, repo, url), plus gitSha. Pending gate facts and resolutions carry gitSha and runId, and deploy records carry admission beside approver. GateRunLocator maps onto RunOrigin with runOriginOfLocator. First written by chant 0.124.28.

  4. lex00 commented on Oct 17, 2026

    @lex00
    ContributorAuthor

    Stored change sets: done in #4022. A pull-request gate's apply stores the change-set document it binds at _change-sets/<digest>.json on chant/lifecycle (under _members/<member>/ in a workspace) before deciding the gate, so the plan an approval bound can be read after the step ends: chant change-set show <digest> --json (read contract change-set-show v1, floor 0.124.28). Each entry carries the graph node id chant workspace graph uses, and a gate in workspace status --json links to its change set in changeSet. Release gates and empty resolutions store theirs through the same storeGateChangeSet call with #4045.

  5. lex00 commented on Oct 17, 2026

    @lex00
    ContributorAuthor

    #4042 (chant run events <run> --json replay and --follow) works for this host only. A local run writes its events to <git-common-dir>/chant/run-events/<run id>.jsonl, and --follow tails that file until run-settle. A run hosted elsewhere (--on fountain) writes nothing there, and run events --on <non-local> refuses and points here. Remote --follow is left to this item: it needs the off-host in-flight state, and what it would read is the same run-event v1 stream (run-event.schema.json, floor 0.124.28), so the reader and the line format need no change.

  6. lex00 commented on Oct 17, 2026

    @lex00
    ContributorAuthor

    From #4036 (retention and chant lifecycle gc): at chant's own rate, a month adds about 8.6 MB of packed history to chant/lifecycle that no tip prune can shed; bounding it needs a history-shedding scheme or a higher-volume backend. Pull-request gates write one _gates/pr-<n>.jsonl each (about 750 a month, 97% of ledger files in the fixture, never pruned); a per-member or per-month PR gate ledger would cap that. _plans/, _builds/, snapshots and checkpoints have no retention policy yet. Append-only ledgers are rewritten as whole blobs on every append, which inflates history. After a prune, readers report a pruned record as missing; one that falls back to history could say "pruned".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions