Skip to content

feat: configure the host agent recursion limit - #352

Merged
eshulman2 merged 9 commits into
forge-sdlc:mainfrom
JoshSalomon:codex/aisos-2485-agent-recursion
Oct 7, 2026
Merged

eshulman2 merged 9 commits into
forge-sdlc:mainfrom
JoshSalomon:codex/aisos-2485-agent-recursion

Conversation

@JoshSalomon

@JoshSalomon JoshSalomon commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Together with PR #351, this PR closes the AISOS-2535 feature.

Host agent graphs can currently use Deep Agents' much larger recursion budget, allowing a stuck task to run far longer than intended. This PR sets Forge's default host graph limit to 100, supports a positive integer global AGENT_RECURSION_LIMIT, and reads the live forge.agent_recursion_limit Jira project property before each ticket run. A missing or null property uses the global value; malformed values and failed reads stop the run. Transient Jira reads have bounded retry and timeout behavior.

project-setup can set or clear the project override, and get-config shows the raw value, effective value, and source in text and JSON, including actionable diagnostics for invalid values. The resolved limit is fixed for each invocation and passed through native, tool-fallback, and retry paths. Graph recursion exhaustion is terminal for that invocation and cannot trigger another graph attempt.

The branch also contains Python 3.12 warning cleanup needed to satisfy the requested warnings-as-errors gate: existing naive-UTC timestamp wire formats are preserved without deprecated utcnow(), Redis testcontainers is imported only when needed, and parser/station/pytest fixtures close their event loops.

Validation: this branch independently passed the complete Python 3.12 suite with -W error (3,611 passed, 25 skipped). In a separate worktree combined with the Vertex PR, the complete suite passed (3,657 passed, 25 skipped). Redis-dependent tests ran only on the host against a disposable local Redis Stack container. Ruff passed for all changed Python files, and targeted mypy passed for the new policy and time modules.

The limit applies to host graph invocations, not container agents or a shared ticket-wide budget. Live provider probing, deployment, and AISOS-2485 recovery remain separate release gates.

Review Follow-Up (2026-10-05)

Addressed the CLI query-isolation review in commit d1e35d7:

  • get-config --models and unrelated --property queries no longer read or validate forge.agent_recursion_limit, avoiding unrelated errors and retry delays. Case-insensitive queries and discovered custom properties are covered.
  • Full configuration output, recursion-property queries, and host agent execution remain fail-closed. The same behavior applies to the project-config alias.
  • Added regression tests and documented the query behavior. TDD evidence: 12 regression cases failed before the production fix; all 20 new cases pass afterward.

Latest verification: 117 focused tests passed; the full suite passed with 3,677 passed and 25 skipped under -W error. Ruff checks and formatting pass for the changed Python files, and every modified executable line and branch is covered. An independent focused review found no issues.

Verification gaps are explicit: 20 legacy workflow tests are intentionally disabled, three tests require the Kind workspace, and two checkpointer tests reported Redis unavailable despite the disposable integration-test Redis being available. Those two skips remain an investigation follow-up, not successful checks; no Jira issue has been created for them yet. The extra CLI mypy check reports the same 25 errors as the unchanged PR baseline, with no new errors introduced by this fix.

@JoshSalomon
JoshSalomon marked this pull request as ready for review October 1, 2026 13:50
@JoshSalomon
JoshSalomon force-pushed the codex/aisos-2485-agent-recursion branch from b9f6cfb to 5b1b6ce Compare October 4, 2026 11:33

@eshulman2 eshulman2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Found one issue:

[P2] Invalid recursion settings block unrelated config queries — src/forge/cli.py, lines 1320–1328.

If forge.agent_recursion_limit is malformed or its read fails, get-config --property forge.repos now exits with an error and returns no repository value. get-config --models is similarly blocked. Restrict this error handling to requests for the recursion property and full configuration output so other configuration queries remain usable.

Review was based on the diff and surrounding code; I did not run tests.

@JoshSalomon

Copy link
Copy Markdown
Contributor Author

Addressed in d1e35d7.

get-config --models and unrelated --property queries now skip the recursion-property lookup entirely, not just its error handling. Full configuration and recursion-specific queries remain fail-closed, as does agent execution.

Verified with TDD: 12 regression cases failed before the fix; all 20 new cases now pass. The full suite passed with 3,677 passed and 25 skipped under -W error. The PR description now includes the detailed verification results and existing gaps, including the two Redis checkpointer skips tracked locally for a later Jira follow-up.

@eshulman2
eshulman2 merged commit 9985378 into forge-sdlc:main Oct 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants