Skip to content

Commit 2519f90

Browse files
committed
fix(api-errors): keep 4xx lower bound; drop redundant 500 check
The earlier `if status < 500` simplification was behaviour-changing: after the `status >= 500` early return the upper bound is always true (CodeQL "redundant comparison" + "unreachable code" on the `return "api"` fallback), but dropping the `>= 400` lower bound also routed sub-400 statuses (e.g. the `status=0` default for non-HTTP-ish errors) into `4xx_client` instead of the generic `api` bucket. Use `if status >= 400` — equivalent to the original `400 <= status < 500` given the preceding return, with the `api` fallback reachable again for status < 400. Also parenthesize the remaining sparse plan-mode reminder concatenation so CodeQL's implicit-string-concatenation check stays quiet without splitting the line across the rendered output.
1 parent e66f43f commit 2519f90

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎src/pythinker_code/soul/api_errors.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def classify_api_error(e: Exception) -> tuple[str, int | None]:
4141
return "auth", status_code
4242
if status >= 500:
4343
return "5xx_server", status_code
44-
if status < 500:
44+
if status >= 400:
4545
msg_lower = str(e).lower()
4646
if any(marker in msg_lower for marker in _CONTEXT_OVERFLOW_MARKERS):
4747
return "context_overflow", status_code

‎src/pythinker_code/soul/dynamic_injections/plan_mode.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,10 @@ def _sparse_reminder(plan_file_path: str | None = None) -> str:
225225
)
226226
parts.extend(
227227
[
228-
"Exit only with a decision-complete plan; "
229-
"record unconfirmed defaults under Assumptions.",
228+
(
229+
"Exit only with a decision-complete plan; "
230+
"record unconfirmed defaults under Assumptions."
231+
),
230232
"Use AskUserQuestion to clarify user preferences "
231233
"when it helps you write a better plan.",
232234
"If the plan has multiple approaches, "

0 commit comments

Comments
 (0)