User Request
The E2E pipeline test in agynio/agents-orchestrator (PR #56) fails because Codex SDK sends a variable number of context messages (environment context, developer instructions, AGENTS.md) before the actual user prompt. The simple-hello test suite expects a fixed number of input items, causing sequence_exhausted errors.
Specification
Problem
The matchInput() function in src/lib/responses/matching.ts does strict 1:1 positional matching between test sequence items and actual input items. When Codex sends [env_context, "hi"] (2 items) but the test defines only ["hi"] (1 input item), the boundary check expectedItems.length === input.length fails.
Solution: Add repeat flag to wildcard message items
Add a repeat: boolean optional field to StoredMessageContentSchema. When repeat: true is set on a wildcard item (with any_role: true AND any_content: true), the matching algorithm treats it as matching 1 or more consecutive input items of any type, greedily consuming items until the next expected item matches.
Changes Required
1. src/lib/responses/matching.ts
- Add
repeat: z.boolean().optional() to StoredMessageContentSchema
- Update
matchInput() to handle repeat wildcards using greedy backtracking:
- Before finding the output boundary, collect input segments with their
repeat flag
- For non-repeat segments: match exactly 1 input item (current behavior)
- For repeat segments: try consuming N items (greedy, max→1), then recursively match remaining segments against remaining input
- Repeat wildcard must consume at least 1 item
2. src/lib/responses/__tests__/matching.test.ts
Add tests for:
- Repeat wildcard absorbing multiple input items before exact match
- Repeat wildcard absorbing single input item
- Repeat wildcard requiring at least 1 match (fails with 0)
- Mixed repeat + non-repeat segments
3. Create simple-hello test suite
After the matching logic change, create the test via API:
{
"name": "simple-hello",
"items": [
{"type": "message", "content": {"role": "user", "content": "ignored", "any_role": true, "any_content": true, "repeat": true}},
{"type": "message", "content": {"role": "user", "content": "hi"}},
{"type": "message", "content": {"role": "assistant", "content": "Hi! How are you?"}}
]
}
This absorbs Codex's variable-length context prefix, matches the user prompt "hi", and returns "Hi! How are you?".
Context
- Related:
agynio/agents-orchestrator#54 (E2E pipeline test)
- The
simple-hello model name is used via MODEL_OVERRIDE=simple-hello in agynd
User Request
The E2E pipeline test in
agynio/agents-orchestrator(PR #56) fails because Codex SDK sends a variable number of context messages (environment context, developer instructions, AGENTS.md) before the actual user prompt. Thesimple-hellotest suite expects a fixed number of input items, causingsequence_exhaustederrors.Specification
Problem
The
matchInput()function insrc/lib/responses/matching.tsdoes strict 1:1 positional matching between test sequence items and actual input items. When Codex sends[env_context, "hi"](2 items) but the test defines only["hi"](1 input item), the boundary checkexpectedItems.length === input.lengthfails.Solution: Add
repeatflag to wildcard message itemsAdd a
repeat: booleanoptional field toStoredMessageContentSchema. Whenrepeat: trueis set on a wildcard item (withany_role: trueANDany_content: true), the matching algorithm treats it as matching 1 or more consecutive input items of any type, greedily consuming items until the next expected item matches.Changes Required
1.
src/lib/responses/matching.tsrepeat: z.boolean().optional()toStoredMessageContentSchemamatchInput()to handle repeat wildcards using greedy backtracking:repeatflag2.
src/lib/responses/__tests__/matching.test.tsAdd tests for:
3. Create
simple-hellotest suiteAfter the matching logic change, create the test via API:
{ "name": "simple-hello", "items": [ {"type": "message", "content": {"role": "user", "content": "ignored", "any_role": true, "any_content": true, "repeat": true}}, {"type": "message", "content": {"role": "user", "content": "hi"}}, {"type": "message", "content": {"role": "assistant", "content": "Hi! How are you?"}} ] }This absorbs Codex's variable-length context prefix, matches the user prompt "hi", and returns "Hi! How are you?".
Context
agynio/agents-orchestrator#54(E2E pipeline test)simple-hellomodel name is used viaMODEL_OVERRIDE=simple-helloin agynd