ZhuLinsen/daily_stock_analysis · error · HTTPException
capability_unsupported
capability_unsupported
Error message
Codex Agent requires the Chat interface with progress and stop support
What it means
Raised during full account replay (portfolio_service.py:924) when a split_adjustment event has split_ratio <= 0 (null coerces to 0.0). The replay must rescale lot quantities and unit costs (FIFO) or average state; a non-positive ratio is uninterpretable and aborts the snapshot with validation_error.
Source
Thrown at api/v1/endpoints/agent.py:212
default_strategy_id=payload.default_skill_id,
)
@router.post("/chat", response_model=ChatResponse)
async def agent_chat(
request: ChatRequest,
session_service: AgentChatSessionService = Depends(get_agent_chat_session_service),
):
"""
Chat with the AI Agent without progress events.
Codex Agent callers must use ``/chat/stream``, which provides progress
events and request cancellation. The default LiteLLM Agent keeps this
endpoint's existing behavior.
"""
config = get_config()
backend_id = _select_agent_chat_backend(config)
if backend_id == "codex_app_server":
raise HTTPException(
status_code=400,
detail={
"error": "capability_unsupported",
"message": "Codex Agent requires the Chat interface with progress and stop support",
},
)
session_id = request.session_id or str(uuid.uuid4())
try:
skill_selection = session_service.resolve_skill_selection(
config,
session_id,
request.effective_skills,
)
skills = skill_selection.effective_skill_ids
selected_skill_ids = skill_selection.selected_skill_ids_update
executor = _build_executor(config, skills or None)View on GitHub (pinned to 5159bd72e8)
Solutions
- Locate the row: query corporate_actions where action_type='split_adjustment' AND (split_ratio IS NULL OR split_ratio <= 0) and fix or delete it
- Use true ratios: 2.0 for a 2-for-1 split, 0.5 for a reverse 1-for-2 split
- Re-insert via add_corporate_action to get write-time validation
- Guard bulk imports to skip rows with missing ratios and report them instead of writing 0
Example fix
# before svc.add_corporate_action(account_id=1, symbol="AAPL", action_type="split_adjustment", split_ratio=0, ...) # after svc.add_corporate_action(account_id=1, symbol="AAPL", action_type="split_adjustment", split_ratio=4.0, ...)
Defensive patterns
Strategy: validation
Validate before calling
def split_ratio_ok(ratio):
return ratio is not None and ratio > 0 Type guard
from numbers import Real
def is_valid_split_ratio(value: Real | None) -> bool:
return value is not None and float(value) > 0.0 Try / catch
try:
svc.get_snapshot(account_id=a)
except ValueError as exc:
if "Invalid split_ratio" in str(exc):
fix_bad_split_rows(a); svc.get_snapshot(account_id=a)
else:
raise Prevention
- Express splits as factors > 0 (2.0 for 2-for-1, 0.5 for reverse)
- Write corporate actions only through add_corporate_action
- Audit corporate_actions for non-positive ratios after imports
When it happens
Trigger: A corporate_actions row with split_ratio=0, negative, or NULL and action_type='split_adjustment' consumed by _replay_account while computing cost basis; sibling of the quantity-replay check at portfolio_service.py:749, hit on the snapshot path where lots and unit costs are also divided by the ratio.
Common situations: Backfills that zero-fill missing split ratios; manual DB corrections; legacy rows created before add_corporate_action enforced split_ratio > 0; reverse-split data entered as a fraction that a rounding step turned into 0.
Related errors
AI-assisted analysis of ZhuLinsen/daily_stock_analysis@5159bd72e8 (2026-08-15).
Data as JSON: /api/errors/66598ed1155e6582.
Report an issue: GitHub.