hwp-pid: Agent crashes if device offline at startup
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 17
- Forks
- 20
- Avg merge
- 1h 22m
- Merged PRs (30d)
- 2
Description
When the agent is started, if the device is offline, the main process will crash:
2026-03-12T18:07:31+0000 startup-op: launching main
2026-03-12T18:07:31+0000 start called for main
2026-03-12T18:07:31+0000 main:0 Status is now "starting".
2026-03-12T18:07:31+0000 main:0 Status is now "running".
2026-03-12T18:07:33+0000 Failed to connect to device at 192.168.12.22:2001
2026-03-12T18:07:33+0000 Failed to connect to device at 192.168.12.22:2001
2026-03-12T18:07:33+0000 Failed to connect to device at 192.168.12.22:2001
2026-03-12T18:07:33+0000 main:0 CRASH: [Failure instance: Traceback: <class 'RuntimeError'>: Could not connect to PID controller
/opt/venv/lib/python3.10/site-packages/twisted/python/threadpool.py:269:inContext
/opt/venv/lib/python3.10/site-packages/twisted/python/threadpool.py:285:<lambda>
/opt/venv/lib/python3.10/site-packages/twisted/python/context.py:117:callWithContext
/opt/venv/lib/python3.10/site-packages/twisted/python/context.py:82:callWithContext
/opt/venv/lib/python3.10/site-packages/ocs/ocs_agent.py:1074:_running_wrapper
/opt/venv/lib/python3.10/site-packages/socs/agents/hwp_pid/agent.py:181:main
/opt/venv/lib/python3.10/site-packages/socs/agents/hwp_pid/drivers/pid_controller.py:50:__init__
/opt/venv/lib/python3.10/site-packages/socs/agents/hwp_pid/drivers/pid_controller.py:78:_establish_connection
]
2026-03-12T18:07:33+0000 main:0 Status is now "done".
socs version: v0.6.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with socs/agents/hwp_pid/agent.py at main and follow the connection setup into drivers/pid_controller.py, especially init and _establish_connection. Reproduce startup with the device offline and trace the RuntimeError shown in the report. Done should be verified by confirming the agent no longer crashes during offline startup and by adding or updating a regression test if the project has coverage for this path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100