Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .operator/analyst/consistency.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Cross-stack consistency checks for the monorepo. Reference, do not restate:

## Package & layer boundaries
- Import direction holds everywhere: `core` (no I/O, no cross-workspace imports; zod only) ← `adapters` ← `engine`; `app` uses `core` types + `adapters` read-only, never `engine` runtime.
- Inside `engine/`, imports flow strictly downward per the layer graph (`platforms/` ⇏ `agents/`, `storage/` ⇏ `pipeline/`, `infra/` → Node built-ins only).
- Inside `engine/`, imports flow strictly downward per the layer graph (`platforms/` ⇏ `agents/`, `storage/` ⇏ `pipeline/`; `infra/` → `@operator/core` runtime + `logging/` (types) + Node built-ins (+ better-sqlite3 under `infra/local/`); `logging/` → `@operator/core` (types only) + pino + optional `pino-pretty` + Node built-ins).
- Primitive-boundary calls (`git.*`, `PRManager.*`, `VCSPlatform.*`, `AgentRuntime.run`, KV writes) appear only in `engine/pipeline/primitives/**`.

## Vocabulary & language
Expand Down
4 changes: 2 additions & 2 deletions .operator/context/engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ pipeline/primitives/ → agents/, platforms/, storage/, infra/, @operator/core
agents/ → platforms/, events/, infra/, @operator/core
platforms/ → infra/, logging/, @operator/core
storage/ → @operator/core, @operator/adapters
infra/ → Node built-ins only
logging/ → nothing
infra/ → @operator/core (runtime), logging/ (types), Node built-ins (+ better-sqlite3 under infra/local/)
logging/ → @operator/core (types), pino, optional pino-pretty, Node built-ins
```
`platforms/` must NOT import `agents/`; `storage/` must NOT import `pipeline/`; etc.

Expand Down
2 changes: 1 addition & 1 deletion .operator/creator/engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Path-scoped guidance for implementing changes in `engine/**`. Full rules:
- Add stage behaviour as config (`engine/content/prompts/stages.yaml` + a prompt file), not a new `pipeline/stages/` file; extend `StageDef` if `runStage` can't express it.
- Thread `OperationContext` through every I/O function and log every action/decision (INFO), payloads (DEBUG), catch-and-continue (WARN), failures with `.cause` (ERROR).
- Never target `master`/`main`/`develop`; never force-push; let `WorkspaceScope` own branch creation and reset workspaces in `finally`.
- Ship a colocated `*.test.ts` with the change; for a bug fix add a regression test that fails on the pre-fix code and names the bug scenario. Keep touched files >=90% coverage (primitives >=95%).
- Ship a colocated `*.test.ts` with the change; for a bug fix add a regression test that fails on the pre-fix code and names the bug scenario. Construct fixtures so they exercise the actual pre-fix failure mode — incidental trimming or fallbacks must not let a broken parser pass (e.g. CRLF frontmatter: use quoted values where trailing `\r` breaks quote-stripping). Keep touched files >=90% coverage (primitives >=95%).
- Named exports, `import type` for types, no `any`/`@ts-ignore`; kebab-case filenames; respect line caps (200 in `pipeline/**`, 300 elsewhere — split rather than trim logs).
- English-only source; generic placeholders instead of real project names.
- Run the gate before finishing: `npm run typecheck && npm run lint && npm test`.
35 changes: 35 additions & 0 deletions .operator/data/findings/F20260806-46A6C4F0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
id: F20260806-46A6C4F0
kind: finding
title: kindForTarget cannot resolve cross-kind status-update targets from singleton-scope retrospective stage
status: pending
priority: 3
created_at: '2026-08-06T22:42:39Z'
parent_id: 2026W31
---

## Problem
`kindForTarget` (`engine/pipeline/primitives/aop-applier.ts:380-402`) resolves explicit
work-item ids by falling back to the active item's kind. The retrospective stage runs under
`selector: singleton` with `scopeKind: week` (`engine/content/prompts/stages.yaml:228`), so
the active item is a retrospective-cycle. When the improver emits `status-update` blocks with
`target: F…` (finding ids), the applier routes them as `kind: retrospective-cycle`, gets
`WI_NOT_FOUND`, and pushes each into `applyErrors`. `weekly-metrics-stage.ts:311-324` only
logs successful applies, so the failure is silent. The 2026W31 retrospective falsely claimed
eleven findings were reconciled to `merged`; none were.

## Solution
Either (a) extend `emitStatusUpdateSchema` / `kindForTarget` to accept an explicit `kind`
field (or resolve kind from id prefix/registry lookup), and add a regression test that applies
a cross-kind status-update from a retrospective-cycle active item; or (b) remove the weekly
reconciliation contract from `engine/content/prompts/agents/improver.md:92-107` if cross-kind
writes are intentionally unsupported from singleton-scope stages. Also log `applyErrors` at
WARN in `weekly-metrics-stage.ts` when non-empty.

## Acceptance Criteria
- Improver `status-update` EMIT blocks targeting finding ids apply successfully from the
retrospective stage, OR improver.md no longer instructs agents to emit cross-kind updates
- Regression test fails on pre-fix `kindForTarget` fallback and passes after
- `weekly-metrics-stage` surfaces applyErrors at WARN when reconciliation events fail
- Build passes

48 changes: 48 additions & 0 deletions .operator/data/retrospectives/2026W31.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## Optimization 2026W31

### Prompt Changes Applied
- `.operator/context/engine.md`: Corrected `infra/` and `logging/` layer-graph lines — `infra/` lists `@operator/core` runtime, `logging/` (types), and `better-sqlite3`; `logging/` lists `@operator/core` (types only), `pino`, and optional `pino-pretty`.
- `.operator/analyst/consistency.md`: Aligned the intra-engine layer-graph bullet with the corrected `infra/` and `logging/` dependencies (including `infra/`'s type-only `Logger` import and `logging/`'s optional `pino-pretty`).
- `.operator/creator/engine.md`: Added regression-test policy requiring fixtures to exercise the actual pre-fix failure mode (quoted CRLF frontmatter example).

### Task Changes
- No reprioritization — P2 security/resilience tasks (`T20260705-760BCFB4`, `T20260705-2BABD6A7`) already outrank P4–P5 split tasks.
- No cancellations — all seven pending split/security tasks remain valid; parent finding `F20260705-CC7FF1B9` still has open children.
- Task bodies for split tasks (`T20260705-94D578A1`, `T20260705-8B7B4079`, `T20260705-8A81A021`, `T20260705-94A14772`, `T20260705-7E556EBC`) already carry corrected line-count estimates from PR #33 review — no further clarification needed.

### Status Reconciliation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI-REVIEWER] blocker — this section commits a false record: it asserts eleven findings were reconciled to status: merged, and none were (all eleven remain in-progress on origin/master; this PR touches no finding file). The cause is structural, not transient: kindForTarget (aop-applier.ts:380-402) cannot resolve an explicit cross-kind id from a singleton-scope stage (stages.yaml:228), so every status-update landed in applyErrors and was swallowed by weekly-metrics-stage.ts:319-324. Fix in this PR: rewrite the section to state what actually happened (updates were requested and did not apply). Separately, EMIT a new finding against kindForTarget so the weekly reconciliation advertised in improver.md:92-107 is either made to work or removed from the prompt — documentation that contradicts the tree is a defect (dev-context-engineering).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed — Rewrote Status Reconciliation to state that eleven status-update EMIT blocks were emitted but none applied (kindForTarget cross-kind resolution failure). Emitting a new finding to fix kindForTarget or remove the reconciliation contract from improver.md.


Eleven finding status-update EMIT blocks were emitted during the improver run (F20260704-0001
through F20260711-EEC50328, each with a completed child task cited in the reason). **None
applied.** On origin/master all eleven findings remain `in-progress`; this PR touches no finding
file.

**Cause:** `kindForTarget` (`aop-applier.ts:380-402`) resolves explicit cross-kind ids by
falling back to the active work-item's kind. The retrospective stage runs under
`selector: singleton` with `scopeKind: week` (`stages.yaml:228`), so the active item is a
retrospective-cycle — not `finding`. Every `status-update` with `target: F…` was routed as
`kind: retrospective-cycle`, produced `WI_NOT_FOUND`, landed in `applyErrors`, and was not
surfaced because `weekly-metrics-stage.ts:311-324` only logs successful applies.

**Follow-up:** A new finding is emitted via AOP in this supervisor cycle to fix `kindForTarget`
(or remove the weekly reconciliation contract from `improver.md:92-107` if cross-kind updates
are intentionally unsupported). Until that lands, improver runs must not claim findings were
reconciled.

**Orphaned child task removed:** The improver run also emitted a child task for
F20260705-0556B309 using the wrong key `parent_id:` (schema expects `parent:`); the applier
created root task T20260727-A58B1D9C with no parent. That task is deleted — the layer-graph fix
already landed on master via PR #35 (task T20260705-E0314F38); no replacement task is needed.

### New Patterns (watching)
- **Structured log payload duplication**: PR #32 flagged putting raw diagnostic text in structured payload fields alongside redacted `msg` — `aop-applier.ts` already omits `message` from payload; watch for recurrence in new log sites.
- **`redactValue` special-object handling**: PR #34 requested Error/Date/URL preservation — already implemented in `redact.ts`; no further action unless new object types appear in log data.
- **`package.json` version load failures**: PR #29 noted `loadPackageVersion()` lacks validation — first occurrence; add creator rule if a second startup/help failure surfaces.
- **Test feature-flag names must match schema**: PR #28 flagged `dailyReport` in a test fixture — first occurrence; watch test hygiene.

### No Changes Needed
- Analyzer prompt files: no "Analyzer Rejection Learning" section in this week's brief.
- Pending split tasks and P2 security/resilience tasks are correctly scoped and prioritized.
- `F20260705-F46054F2` stays open: WARN path fixed (`T20260705-F00733CA`) but pagination task `T20260705-2BABD6A7` still pending.
- `F20260705-F595B0A3` stays open: token-env stripping task `T20260705-760BCFB4` still pending.
- `packages.md` already correctly describes `@operator/core` runtime (Zod + error classes); no edit required.