motir-core: carry the setting in the job envelope's context — a cross-repo contract that fails silently
The producer half of the crossing. motir-ai cannot read motir-core's database, so the setting reaches the capture path only if the job envelope carries it:
const envelope: RequestEnvelope = { envelopeVersion: 'v1', jobKind, tenant, context, readBackToken };
context: JobContextBag is the extensible slot. Add the flag there for every job kind whose run can capture a lesson, resolved from the project's settings at submit time.
⚠️ This is the failure class the file itself already warns about, one field over:
"IT IS A CROSS-REPO CONTRACT AND IT FAILS CLOSED AND SILENTLY … a typo on either side produces a
validation_error… no type error, no test"
There is no shared type across the two repositories, so the field name is a string agreement between two codebases. Name it once, in a named constant rather than an inline literal, and quote it in the PR body so the consumer card is verifiable against it by reading rather than by running.
Send it explicitly, always — never omit the field when capture is enabled and rely on the consumer defaulting. An absent field and a false field must be distinguishable on the wire, because the consumer has to tell "this project switched it off" from "this envelope predates the field", and those need opposite behaviour.
Acceptance criteria
- The flag is in
contexton every job kind that can capture, resolved from the project's setting at submit time. - The field name lives in one named constant; no inline string literal at the call site.
- The value is always present when the job is submitted by a version that knows about it — absent means "old producer", not "off".
- The PR body quotes the exact field name so the consumer card can be checked against it by reading.
- Submitting with the setting off produces an envelope carrying
false, asserted on the serialized body rather than on an intermediate object. - The envelope stays
envelopeVersion: 'v1'-valid; an older consumer ignoring the field is unaffected.
Context refs
motir-corelib/ai/motirAiClient.ts—submitJob,RequestEnvelope,JobContextBag, and the cross-repo-contract warning beside it.motir-corelib/services/projectAiSettingsService.ts— where the setting is read from.- MOTIR-3349 — the field this reads.
- MOTIR-3351 — the consumer that must agree on the name.