fix: resolve not-subscriptable ty diagnostics across codebase

Add TypedDicts for DEFAULT_CONFIG, CLI state dicts (_ModelPickerState,
_ApprovalState, _ClarifyState), and OPTIONAL_ENV_VARS so ty can resolve
nested dict subscripts.  Guard Optional returns before subscripting
(toolsets, cron/scheduler, delegate_tool), coerce str|None to str before
slicing (gateway/run, run_agent), split ternary for isinstance narrowing
(wecom), and suppress discord interaction.data access with ty: ignore.
This commit is contained in:
alt-glitch 2026-04-21 16:59:13 +05:30
parent 1e7a598bac
commit b11e53e34f
9 changed files with 404 additions and 24 deletions

View file

@ -1602,7 +1602,7 @@ def delegate_task(
n_tasks = len(task_list)
# Track goal labels for progress display (truncated for readability)
task_labels = [t["goal"][:40] for t in task_list]
task_labels = [str(t["goal"] or "")[:40] for t in task_list]
# Save parent tool names BEFORE any child construction mutates the global.
# _build_child_agent() calls AIAgent() which calls get_tool_definitions(),