Skip to content

report-status POST bypasses the UA-configured session (uses requests.post, not session.post) #48

Description

@lucos-architect

Problem

schedule_tracker.py configures a requests.Session with a conforming User-Agent: SYSTEM header (per lucos ADR-0001), but the actual report-status call bypasses that session by using the module-level requests.post():

session = requests.Session()
session.headers.update({
    "User-Agent": SYSTEM,
    "Content-Type": "application/json",
})
...
schedule_tracker_response = requests.post(SCHEDULE_TRACKER_ENDPOINT, json=payload, timeout=30)  # line 55 — uses requests.post, NOT session.post

requests.post() uses a fresh default session, so the configured User-Agent is never sent — the request goes out with the library default python-requests/2.34.x. Because this is a shared client library, the effect is estate-wide: every python service that reports status via this client emits a non-identifying python-requests UA for those calls (SRE attributed a ×61 POST /v2/report-status slice on the router to exactly this line during the 2026-06-28 cutover triage).

This is the textbook per-code-path failure behind lucas42/lucos#251: a configured client exists, but a call-site bypasses it with a raw module-level call.

The fix (one line)

Use the configured session:

schedule_tracker_response = session.post(SCHEDULE_TRACKER_ENDPOINT, json=payload, timeout=30)

session.post carries both the User-Agent: SYSTEM and Content-Type: application/json headers already on the session; the timeout=30 argument is unchanged. No other change needed.

Reference for the correct pattern — its sibling does it right: lucos_loganne_pythonclient/loganne.py:34 uses session.post(LOGANNE_ENDPOINT, json=payload) against the same requests.Session() + User-Agent: SYSTEM setup. This change just makes schedule_tracker_pythonclient match it.

Rollout note

The fix is one line in the client lib, but consumers benefit only once they bump to the fixed client version and redeploy (standard dependency propagation — not a coordinated cutover). No urgency; it's a hygiene/observability fix.

Acceptance criteria

  • schedule_tracker.py line 55 uses session.post(...) (not requests.post(...)).
  • A report-status call from a service using this client shows User-Agent: <that service's SYSTEM> in the destination access log, not python-requests.

Context

Not urgent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions