Skip to content

fix(agent-server): ignore a non-object base_state.json in the status index - #6592

Merged
VascoSch92 merged 1 commit into
mainfrom
vasco/status-index-non-object
Nov 7, 2026
Merged

VascoSch92 merged 1 commit into
mainfrom
vasco/status-index-non-object

Conversation

@VascoSch92

@VascoSch92 VascoSch92 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

HUMAN:

just fixing a bug


AGENT:

Why

Status-filtered search_conversations / count_conversations read just execution_status from each base_state.json through _read_execution_status_sync, which suppresses OSError and ValueError so that one unreadable or corrupt file keeps its cached status. A file holding valid JSON that is not an object ([], "x", 1) gets past json.loads, and payload.get(...) raises AttributeError. That escapes the reader, so every status-filtered listing and count fails while that file exists.

Summary

Issue Number

Part of #6348 (item: "_read_execution_status_sync only suppresses OSError/ValueError; a non-object payload raises AttributeError and fails every status-filtered count").

How to Test

uv run pytest tests/agent_server/test_conversation_service.py -k TestConversationSearchScaling

The non-object case fails on main (AttributeError: 'list' object has no attribute 'get') and passes here; the class passes (8).

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

🐳 Agent Server images for this PR — GHCR package, pull/run commands, and all pushed tags (click to expand)

• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python-slim amd64, arm64 python-node-runtime Link
python-minimal amd64, arm64 python-node-runtime Link
python amd64, arm64 python-node-runtime Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:70a4d42-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-70a4d42-python \
  ghcr.io/openhands/agent-server:70a4d42-python

All tags pushed for this build

ghcr.io/openhands/agent-server:70a4d42-golang-amd64
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-golang-amd64
ghcr.io/openhands/agent-server:vasco-status-index-non-object-golang-amd64
ghcr.io/openhands/agent-server:70a4d42-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:70a4d42-golang-arm64
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-golang-arm64
ghcr.io/openhands/agent-server:vasco-status-index-non-object-golang-arm64
ghcr.io/openhands/agent-server:70a4d42-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:70a4d42-java-amd64
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-java-amd64
ghcr.io/openhands/agent-server:vasco-status-index-non-object-java-amd64
ghcr.io/openhands/agent-server:70a4d42-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:70a4d42-java-arm64
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-java-arm64
ghcr.io/openhands/agent-server:vasco-status-index-non-object-java-arm64
ghcr.io/openhands/agent-server:70a4d42-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:70a4d42-python-amd64
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-python-amd64
ghcr.io/openhands/agent-server:vasco-status-index-non-object-python-amd64
ghcr.io/openhands/agent-server:70a4d42-python-node-runtime-amd64
ghcr.io/openhands/agent-server:70a4d42-python-arm64
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-python-arm64
ghcr.io/openhands/agent-server:vasco-status-index-non-object-python-arm64
ghcr.io/openhands/agent-server:70a4d42-python-node-runtime-arm64
ghcr.io/openhands/agent-server:70a4d42-python-minimal-amd64
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-python-minimal-amd64
ghcr.io/openhands/agent-server:vasco-status-index-non-object-python-minimal-amd64
ghcr.io/openhands/agent-server:70a4d42-python-node-runtime-minimal-amd64
ghcr.io/openhands/agent-server:70a4d42-python-minimal-arm64
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-python-minimal-arm64
ghcr.io/openhands/agent-server:vasco-status-index-non-object-python-minimal-arm64
ghcr.io/openhands/agent-server:70a4d42-python-node-runtime-minimal-arm64
ghcr.io/openhands/agent-server:70a4d42-python-slim-amd64
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-python-slim-amd64
ghcr.io/openhands/agent-server:vasco-status-index-non-object-python-slim-amd64
ghcr.io/openhands/agent-server:70a4d42-python-node-runtime-slim-amd64
ghcr.io/openhands/agent-server:70a4d42-python-slim-arm64
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-python-slim-arm64
ghcr.io/openhands/agent-server:vasco-status-index-non-object-python-slim-arm64
ghcr.io/openhands/agent-server:70a4d42-python-node-runtime-slim-arm64
ghcr.io/openhands/agent-server:70a4d42-golang
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-golang
ghcr.io/openhands/agent-server:vasco-status-index-non-object-golang
ghcr.io/openhands/agent-server:70a4d42-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:70a4d42-java
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-java
ghcr.io/openhands/agent-server:vasco-status-index-non-object-java
ghcr.io/openhands/agent-server:70a4d42-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:70a4d42-python-minimal
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-python-minimal
ghcr.io/openhands/agent-server:vasco-status-index-non-object-python-minimal
ghcr.io/openhands/agent-server:70a4d42-python-node-runtime-minimal
ghcr.io/openhands/agent-server:70a4d42-python-slim
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-python-slim
ghcr.io/openhands/agent-server:vasco-status-index-non-object-python-slim
ghcr.io/openhands/agent-server:70a4d42-python-node-runtime-slim
ghcr.io/openhands/agent-server:70a4d42-python
ghcr.io/openhands/agent-server:70a4d42d11602267a13260ecebe0b120bc348d00-python
ghcr.io/openhands/agent-server:vasco-status-index-non-object-python
ghcr.io/openhands/agent-server:70a4d42-python-node-runtime

About Multi-Architecture Support

  • Each variant tag (e.g., 70a4d42-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 70a4d42-python-amd64) are also available if needed

…index

_read_execution_status_sync suppressed OSError and ValueError, but a
base_state.json holding valid JSON that is not an object (e.g. []) made
payload.get raise AttributeError, which failed every status-filtered
search and count. Suppress it too, so the cached status is kept as for
the other corrupt cases.
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-agent-server/openhands/agent_server
   conversation_service.py127310092%186–187, 269, 290, 464–465, 631, 638–639, 740, 831, 882–883, 890, 922–923, 939, 970, 974, 986, 1006, 1027–1028, 1037, 1106, 1116, 1141, 1147–1148, 1152–1153, 1161, 1188, 1194, 1288, 1294, 1299, 1305, 1313–1314, 1323–1326, 1335, 1348, 1366, 1403, 1407–1411, 1434, 1483, 1496, 1504, 1562–1563, 1567, 1773, 1851, 1975, 1978, 1985–1987, 1990–1991, 1997, 2007, 2011, 2040, 2049, 2108–2110, 2141, 2272, 2275, 2302, 2312, 2317–2320, 2334, 2345, 2357–2358, 2390, 2488, 2548, 2606, 2621–2622, 3028, 3081, 3084, 3097
TOTAL541792071662% 

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result: ✅ PASSED

Action log

@all-hands-bot all-hands-bot 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.

This review was posted by an AI agent (OpenHands).

Scope

In scope for this repository: _read_execution_status_sync is the agent-server status index reader behind status-filtered search_conversations/count_conversations, and the change implements the pinned item from #6348 (open, bug, ready-for-dev). No product or architecture decision is required.

Fix verified in the workspace

  • payload.get("execution_status", ...) (conversation_service.py:524) raises AttributeError for a non-object JSON payload ([], "x", 1), and the single call site _refresh_persisted_statuses_sync (:924, invoked via asyncio.to_thread from _refresh_execution_statuses) let it escape, failing every status-filtered listing and count while such a file existed. Adding AttributeError to the suppress(...) makes _read_execution_status_sync return None, which the caller already maps to "keep the cached status, unverified, retry on a later query" — the same documented semantics as a truncated file or an unknown enum value. Recovery is preserved because _state_signature is mtime+size based, so a later valid rewrite is re-read.
  • No over-broad masking: within the suppress block only open, json.loads, and ConversationExecutionStatus(...) run; json.loads does not raise AttributeError, and invalid enum values already raise the intended ValueError. The only newly suppressed case is the non-mapping .get this PR targets.
  • No public Python/REST/OpenAPI surface changes; private module-level helper only (OpenAPI breakage check green).

Tests and evidence

  • The added test is byte-identical to the pinned test in #6348 modulo removal of the strict xfail marker, which the issue's protocol requires in the fixing PR.
  • I reproduced the bug on main in a disposable worktree (no tracked files modified) by applying only the test patch: the non-object case fails with exactly AttributeError: 'list' object has no attribute 'get' escaping via _refresh_persisted_statuses_sync, while truncated/bad-enum pass. On this head the full class passes (8/8) and tests/agent_server/test_conversation_service.py passes 148/148.
  • GitHub Actions on this exact head (70a4d42d…) is green, including agent-server-tests, agent-server-stress-tests, integration-test, cross-tests, windows-tests, security, and pre-commit (verified run head SHAs match).

No material findings.

✅ APPROVED

@VascoSch92
VascoSch92 merged commit 11d568c into main Nov 7, 2026
52 of 53 checks passed
@VascoSch92
VascoSch92 deleted the vasco/status-index-non-object branch November 7, 2026 21:52
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