Fix Trellis sub-agent recursion when a workflow-state instruction reaches a sub-agent (Documentation Index
Fetch the complete documentation index at: https://docs.trytrellis.app/llms.txt
Use this file to discover all available pages before exploring further.
#237); fix compareVersions dropping the tail of hyphenated prereleases (#230). No new migrations.
Bug Fixes
Sub-agent recursion guard
.trellis/workflow.md’s [workflow-state:in_progress] block tells the main agent to dispatch trellis-implement / trellis-check sub-agents. On Codex the same block also reaches the spawned sub-agent’s turn, and the sub-agent followed the rule on itself — spawning another trellis-implement instead of doing the work.
Two changes:
[workflow-state:in_progress]scopes the dispatch rule to the main session, and adds an explicit “if you are already atrellis-implement/trellis-checksub-agent, work directly and do not spawn another one” exemption.- Each platform’s
trellis-implement/trellis-checkagent definition (claude / cursor / opencode / kiro / codebuddy / droid / codex / pi / gemini / qoder) carries the same exemption, so the guard holds even if the workflow-state injection is missed.
.trellis/spec/cli/backend/workflow-state-contract.md updated: previously claimed only the main session could see workflow-state breadcrumbs, but Codex hooks deliver them to sub-agents too.
compareVersions: hyphens inside prereleases
Thanks to @voidborne-d for #230.
packages/cli/src/utils/compare-versions.ts used a.split("-", 2) to separate the base version from the prerelease tag. JavaScript’s split(sep, limit) truncates the result instead of joining the tail (unlike Python’s maxsplit):
compareVersions("1.0.0-alpha-1", "1.0.0-alpha-2") returned 0 — the two versions sorted as equal. Fixed. Adds 20 test cases in packages/cli/test/utils/compare-versions.test.ts covering base versions, release vs prerelease, hyphenated identifiers, and version-list sorting.