Skip to content

chore(agents): record chat-graph-canonical decision, move ask-human defaults to SSOT (#21024) - #21058

Closed
mrveiss wants to merge 5 commits into
mainfrom
issue-21024-agentloop-decision-ssot
Closed

mrveiss wants to merge 5 commits into
mainfrom
issue-21024-agentloop-decision-ssot

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Thinking Path

The maintainer decision on #20846 made the chat graph the canonical loop, so AgentLoop needs a recorded status and the ask-human defaults need one home. One issue covers the record, the defaults and the guard because they are the same decision (point 4c); splitting them would leave the docstring and the settings disagreeing between PRs.

What Changed

  • autobot_shared/ssot_chat_graph_settings.py (new): ChatGraphSettings. It is a separate module because ssot_config.py is at its size ceiling; ssot_config.py only gains the hook (about 6 lines).
  • Defaults, one definition each: planner off (AUTOBOT_CHAT_PLANNER_ENABLED), stall escalation stop (AUTOBOT_CHAT_STALL_ESCALATION) - consumed by feat(chat): stall escalation asks a human through a chat-graph interrupt (#20846a) #21022, ask-human timeout 300 s (AUTOBOT_ASK_HUMAN_TIMEOUT_SECONDS), ask-human policy abandon.
  • New env var AUTOBOT_ASK_HUMAN_ESCALATION_POLICY, registered in env_registry_agent_tools.py and documented in docs/developer/ENV_VARS.md.
  • AgentLoop and the agent_loop package docstrings carry a PORTED TO THE CHAT GRAPH decision record; the superseded "NOT WIRED IN PRODUCTION" paragraph is removed and loop.py / types.py / AGENT_MATURITY_LEVELS.md agree with it.
  • repo_tests/agent_loop_ported_to_chat_graph_20846_test.py: the wiring guard.

Overlap: this touches about 3 lines of ssot_config.py that #20980 also touches; the train master reconciles them.

Verification

  • repo_tests/agent_loop_ported_to_chat_graph_20846_test.py and repo_tests/ai_line_single_policy_18430_test.py: 24 passed together.
  • configuration_guide_env_vars_test.py, env_registry_is_extensible_test.py, env_var_bare_cast_test.py: 36 passed.

Single-issue rationale

The decision record and the SSOT defaults are one decision (#20846 point 4c), and #21023 is stacked on this commit so it needs a base to target; no other open issue shares these files.

Risks

None identified. Defaults keep today's behaviour; the new env var defaults to abandon.

Model Used

Claude Sonnet 5.5 (claude-sonnet-5-5)

Issue Link

Closes #21024

Changelog fragment

  • N/A (internal change)

Checklist

  • Code follows AutoBot patterns from CLAUDE.md
  • Tests added or updated (or N/A with reason)
  • Documentation updated if behavior changed
  • Pre-commit hooks pass (git commit runs them automatically)
  • PR targets main (not release)
  • No secrets or credentials in the diff

Pre-handover (docs/developer/CLAUDE_REVIEW.md, #19285)

  • Every guard or test this body claims exists and ran
  • Size ceilings met by splitting, not by trimming text
  • Every cited owner decision is quoted on its issue
  • Pre-push green: it runs the whole-tree guards (symbol forks, isolated-git, file size, reach)

@mrveiss mrveiss added the phase:M4.9 One definition per concept label Nov 7, 2026
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@mrveiss

mrveiss commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) at bf2869d

Verdict: APPROVE-READY — the four settings are defined once in ChatGraphSettings, agent_loop/types.py reads them with no literals, and every AC of #21024 has evidence. The notes below are low severity.

Severity file:line Finding Fix
Low autobot_shared/ssot_chat_graph_settings.py:30 The policy is now a Literal. I ran it with AUTOBOT_ASK_HUMAN_ESCALATION_POLICY=bogus and importing ssot_config raised a literal_error. Before, a typo was a plain string. Valid values (re_ask, ask) load correctly. A typo in one env var now stops config import for the whole process. Accept the fail-fast and say so in the ENV_VARS row (the row lists no allowed values), or fall back to the default with a logged warning.
Low autobot_shared/ssot_chat_graph_settings.py:28 ask_human_timeout_seconds was read through env_int, and is now a bare pydantic int. A non-integer value now fails config load. There is no lower bound, so 0 or a negative value is accepted. Field(default=300, ge=1, ...).
Low autobot_shared/ssot_config.py:57-61, 213, 297 The edit is 6 changed lines, not 3. The extra three compact the chat_inline_judge_enabled comment. That is unrelated churn in a file that open PR #20980 also edits, and it is the likeliest conflict spot. Revert the comment hunk so the diff is the import plus the base class. The reconciliation is then trivial.
Low repo_tests/agent_loop_ported_to_chat_graph_20846_test.py No test asserts that each of the four env names is registered exactly once. I checked by grep: AUTOBOT_ASK_HUMAN_TIMEOUT_SECONDS is registered once, in env_registry_agent_runtime.py:114. The other three are registered once each in env_registry_agent_tools.py. Add a count assertion to the guard, with a control.

AC evidence (all checked against the head):

Not checked: CI. Most checks on this head show fail, many with 0s duration. SSOT Configuration Compliance, verify-precommit-config and startup-import-smoke also fail. I did not read the logs and cannot say if they are infra or real, so the PR needs a CI re-run and a cause check before merge. I did not run the full suite. I did not check the merge against #20980.

@mrveiss

mrveiss commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Pushed 8fa0865: review LOW fixes

  • ask_human_timeout_seconds now has ge=1
  • a bad AUTOBOT_ASK_HUMAN_ESCALATION_POLICY / AUTOBOT_CHAT_STALL_ESCALATION fails fast (kept), with a message naming the variable and allowed values; ENV_VARS rows say so; new test chat_graph_settings_validation_21024_test
  • ssot_config.py comment hunk NOT reverted: reverting makes the file 3207 lines, over its 3206 ceiling, so the compaction stays
  • env name registered once: already covered by env_registry_is_extensible_test::test_no_variable_is_registered_twice (globs every env_registry*.py), no new guard

@mrveiss

mrveiss commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) at 8fa0865

Verdict: APPROVE-READY — every earlier finding is addressed in the delta bf2869d849..8fa0865c75; the remaining notes are LOW.

Earlier finding Status Evidence
ssot_config.py comment compaction must stay Confirmed The file is exactly 3206 lines on the PR head and on main, and the ceiling in scripts/python_file_size_known_large.py is 3206. The PR adds the ChatGraphSettings import and base class, so the two-line comment compaction is what keeps the line count equal. Reverting it would put the file over the ceiling.
ask_human_timeout_seconds unbounded Fixed Field(default=300, ge=1, ...); test_timeout_has_a_lower_bound covers 0 and -5.
Bad policy value gave a raw Literal error Fixed, fail-fast kept _enum_names_its_variable (a mode="before" validator) raises <ALIAS> must be one of abandon, default, re_ask; got 'bogus'. It still raises, so config load fails on a typo. test_typo_names_variable_and_allowed_values covers both enum fields.
New test file Present and passing repo_tests/chat_graph_settings_validation_21024_test.py: 5 cases (valid load, 2 typos, 2 bounds).
Exactly-once registration Claim holds env_registry_is_extensible_test::test_no_variable_is_registered_twice iterates _MODULES = SHARED.glob("env_registry*.py"). That glob includes env_registry_agent_tools.py, so these registrations are covered. The test passes.
Env descriptions Updated Both descriptions in env_registry_agent_tools.py and ENV_VARS.md now say that any other value fails config load. Longest line is 109 characters, under the 120 limit.

New findings:

  • LOW: the validator reads field.annotation.__args__, so it only works for Literal[...] fields. It is correct for the two fields it is attached to; a future non-Literal field added to the decorator list would fail with an unclear error.

Not checked: CI status; behaviour of the downstream consumers of the setting beyond the existing agent_loop_ported_to_chat_graph_20846_test, which passed with this branch's code (run at the #21023 head, which contains this commit).

@mrveiss

mrveiss commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) at 8fa0865

Verdict: APPROVE (code). Merge gate: CI shows failing checks at this head (api-wiring, Security Scan, verify-types-run, verify-precommit-config, python-suite and others); I did not diagnose them, and red CI does not merge.

Scope: 10 files changed, 0 behind main, 0 unresolved review threads.

AC check (#21024): docstring marked PORTED (loop.py, __init__.py) - met; wiring assertion (agent_loop_ported_to_chat_graph_20846_test.py, with a planted-input control) - met; ask-human timeout and policy defined once in SSOT (ChatGraphSettings, types.py reads config.llm.*) - met; ENV_VARS entries - met.

# Severity Finding
1 Low AUTOBOT_CHAT_PLANNER_ENABLED and AUTOBOT_CHAT_STALL_ESCALATION are registered and documented here, but nothing reads the stall setting yet (consumer is #21022). Acceptable as the SSOT home; keep #21022 linked so the setting is not left unwired.
2 Low ChatGraphSettings repeats model_config (env_file) that LLMConfig already declares; harmless under multiple inheritance, but one declaration would be tidier.
3 Info ssot_config.py stays at 3206 lines (ratchet ceiling unchanged); new module is 42 lines; no function over 30 lines; no UI strings; no secrets; validator fails fast naming the variable; timeout has ge=1.
4 Info The env var AUTOBOT_ASK_HUMAN_TIMEOUT_SECONDS keeps a single registration in env_registry_agent_runtime.py; no duplicate definition.

@mrveiss

mrveiss commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Review fixes pushed at 0f329e5.

Finding Fix Where
(a) ChatGraphSettings repeated LLMConfig's model_config LLMConfig no longer declares its own; it inherits the one ConfigDict from ChatGraphSettings. The ssot_config.py size ceiling is lowered 3206 to 3202. autobot_shared/ssot_config.py (~227), autobot_shared/ssot_chat_graph_settings.py:22, scripts/python_file_size_known_large.py:474
(b) PR body did not link the consumer of AUTOBOT_CHAT_STALL_ESCALATION Body now says it is consumed by #21022. PR body

Test: repo_tests/chat_graph_settings_validation_21024_test.py:31-37 (test_llm_config_inherits_the_one_config_dict). Run with the agent-loop guard and the unconnected-code gate: 36 passed.

@mrveiss

mrveiss commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) at 3a03e0e

Verdict: APPROVE. Delta over the earlier pass is the one fix commit (0f329e5). 0 behind main, 11 files, 0 review threads.

# Severity Finding Verdict
1 Info LLMConfig no longer repeats model_config. Bases are (RedactedSettings, ChatGraphSettings); RedactedSettings carries only BaseSettings defaults, so ChatGraphSettings (the later base) supplies env_file, env_file_encoding="utf-8", extra="ignore". Same values the removed dict had; project_root() is the same function that fed PROJECT_ROOT. OK
2 Info Neither config sets env_prefix; every field uses an explicit alias, so env names, extra-ignore and validation are unchanged. The new test asserts the three keys match and extra == "ignore". OK
3 Info ssot_config.py ceiling 3206 to 3202 matches the file (3202 lines). The 600-line cap is not met by this file, but its ceiling ratchets down, as intended. OK
4 Info No sleeps, no line-number comments, no new functions over 30 lines. OK
5 Low The merge gate, not this delta, is the CI state noted in the earlier pass. Not re-assessed

@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Landed on main via merge train #21093 (merge commit b83a986); every commit of head 3a03e0e is in main.

@mrveiss

mrveiss commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Branch audit (zero-change deletion). This PR shows 0 changed files against main (head 18504507b5): every change it carried is already in main. Closing and deleting the branch through this PR; it can be restored with the Restore branch button below.

@mrveiss mrveiss closed this Nov 18, 2026
@mrveiss
mrveiss deleted the issue-21024-agentloop-decision-ssot branch November 18, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

phase:M4.9 One definition per concept

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(agents): record the chat-graph-canonical decision and move ask-human defaults to SSOT (#20846c)

1 participant