Skip to content

Commit b532500

Browse files
authored
Merge pull request #191 from speakeasy-api/fix/guide-context-order
fix(factory): allow interleaved context reads
2 parents 536784a + 0b7f171 commit b532500

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

factory/coordinator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ return if context_attempt.caught {
4545
}
4646
```
4747

48-
If the program returns `factory_status`, set terminal state to `failed`, record the fixed blocker `Phase 1 guide-context inspection failed.`, set `stop_model_phases = true`, skip every remaining model phase, and continue to atomic report creation. Otherwise the program must return the successful shell result object unchanged; do not parse, project, or reshape it inside compose. Read authority, role, schema, persona, representative-guide, and target-artifact contents only from its `.files` object. If Kit spills this large result, consume it only through the repository spill reader. First execute exactly `bash factory/scripts/read-guide-context-spill.sh <artifact> index` in a caught boundary, where `<artifact>` is the exact path returned by Kit. Then consume every listed file in index order with caught commands shaped exactly `bash factory/scripts/read-guide-context-spill.sh <artifact> read <index> <offset>`: start each file at offset 0, use only the returned next_offset, and repeat until done=true before moving to the next index. Never construct jq, sed, Python, or other free-form spill commands; never read a spill with shell redirection or a generic file command. A rejected spill, missing index/chunk, changed path/index/offset, or incomplete file consumption selects failed; never inspect repository files directly or run another Phase 1 file-discovery tool. Resolve the persona only after reading every available definition under `doctrine/personas/`: default to `it-admin`; override it only when the issue confidently names an available repository persona. Pass the selected `doctrine/personas/<persona>.md` file to every downstream agent and reviewer. Resolve catalog presence only from the `.catalog` object returned by the initial command; never inspect `/input/catalog.json` directly. Preserve tenanted remote and `speakeasy_add_server` catalog/custom-remote doctrine. Skipped, malformed, stale, or ambiguous lookup means unknown, never absence; preserve both safe setup paths and record a research limitation rather than asking the operator to repeat the lookup.
48+
If the program returns `factory_status`, set terminal state to `failed`, record the fixed blocker `Phase 1 guide-context inspection failed.`, set `stop_model_phases = true`, skip every remaining model phase, and continue to atomic report creation. Otherwise the program must return the successful shell result object unchanged; do not parse, project, or reshape it inside compose. Read authority, role, schema, persona, representative-guide, and target-artifact contents only from its `.files` object. If Kit spills this large result, consume it only through the repository spill reader. First execute exactly `bash factory/scripts/read-guide-context-spill.sh <artifact> index` in a caught boundary, where `<artifact>` is the exact path returned by Kit. Consume listed files with caught commands shaped exactly `bash factory/scripts/read-guide-context-spill.sh <artifact> read <index> <offset>`. Files may be consumed in any order or interleaved. For each index, start each file at offset 0 and use only that file's returned next_offset until it reaches done=true; never use one file's offset for another index. Every listed file must reach done=true before Phase 2. Never construct jq, sed, Python, or other free-form spill commands; never read a spill with shell redirection or a generic file command. A rejected spill, missing index/chunk, changed path/index/offset, or incomplete file consumption selects failed; never inspect repository files directly or run another Phase 1 file-discovery tool. Resolve the persona only after reading every available definition under `doctrine/personas/`: default to `it-admin`; override it only when the issue confidently names an available repository persona. Pass the selected `doctrine/personas/<persona>.md` file to every downstream agent and reviewer. Resolve catalog presence only from the `.catalog` object returned by the initial command; never inspect `/input/catalog.json` directly. Preserve tenanted remote and `speakeasy_add_server` catalog/custom-remote doctrine. Skipped, malformed, stale, or ambiguous lookup means unknown, never absence; preserve both safe setup paths and record a research limitation rather than asking the operator to repeat the lookup.
4949

5050
## Phase 2 — research and scope gate
5151

factory/tests/test-coordinator.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ for phrase in \
2626
'never inspect repository files directly or run another Phase 1 file-discovery tool' \
2727
'bash factory/scripts/read-guide-context-spill.sh <artifact> index' \
2828
'bash factory/scripts/read-guide-context-spill.sh <artifact> read <index> <offset>' \
29-
'start each file at offset 0, use only the returned next_offset' \
29+
'Files may be consumed in any order or interleaved' \
30+
'start each file at offset 0 and use only that file' \
31+
'Every listed file must reach done=true before Phase 2' \
3032
'Never construct jq, sed, Python, or other free-form spill commands' \
3133
'incomplete file consumption selects failed' \
3234
"catalog presence only from the \`.catalog\` object returned by the initial command" \
@@ -63,6 +65,10 @@ for phrase in \
6365
grep -Fq "$phrase" "$CONTRACT" || fail "missing contract: $phrase"
6466
done
6567

68+
if grep -Fq 'in index order' "$CONTRACT"; then
69+
fail 'guide-context spill contract still requires global index order'
70+
fi
71+
6672
context_boundary=$(cat <<'RUNLET'
6773
context_attempt = boundary {
6874
result = shell({ command: "bash factory/scripts/inspect-guide-context.sh <slug>" })

0 commit comments

Comments
 (0)