POST requests without a body (e.g. Reiniciar, Apagar) caused
json.loads("") to raise JSONDecodeError, which sent a 500 response
but continued executing the handler, resulting in a double response.
The client received 500 while the handler actually succeeded.
- Handle missing or zero Content-Length without attempting JSON parse
- Add return after sendJsonError to prevent calling notifyMessage after
an error response has already been sent
- Track registration state with _registered flag; monitoring thread
re-sends ogagent/started when contact with ogcore is restored
- Fix AttributeError in REST client when a network-level error
(timeout, connection refused) occurred: e.response is None for
non-HTTP failures, so guard before accessing .status_code
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ogagent/pipeline/head This commit looks goodDetails
## Summary
- Write the authentication token to `/tmp/ogagent.token` on oglive startup so local scripts can authenticate against the agent without needing to know the token in advance.
- Remove token file writing from OS/Windows mode (`OpenGnSys` module), where it was being written to `/opt/opengnsys/etc/ogagent.token`. The token file is now exclusive to oglive mode.
## Test plan
- [ ] Boot a machine into oglive and verify `/tmp/ogagent.token` is created with a 32-character alphanumeric token
- [ ] Verify a local script can read the token and use it to authenticate against the agent REST API
- [ ] Boot a machine into a normal OS (Windows/Linux) and verify `/opt/opengnsys/etc/ogagent.token` is **not** created
- [ ] Verify normal agent operation is not affected in OS mode (connection to ogcore, script execution, etc.)
Co-authored-by: Nicolas Arenas <nicolas.arenas@qindel.com>
Reviewed-on: #70