Skip to content

Housekeeping - #102

Merged
berges99 merged 2 commits into
mainfrom
fix/gateway-421-gc-and-docs-reorg
Jul 28, 2026
Merged

Housekeeping#102
berges99 merged 2 commits into
mainfrom
fix/gateway-421-gc-and-docs-reorg

Conversation

@berges99

Copy link
Copy Markdown
Collaborator

No description provided.

… it into two commits rather than one giant one — cleaner history and easier to review/revert independently:

Commit 1 — the SDK/test fixes:
fix: correct stale gateway hostname and stop File from fetching on GC

The Python SDK's service-call gateway still hardcoded the retired
proj-env-{env_id} hostname, causing every deployed cross-service call
(sibling agent, api, ui) to 421 against the ALB. Switch to the
canonical e{env_id} host, with TIMBAL_PROJECT_ENV_ORIGIN /
TIMBAL_DEPLOYMENTS_DOMAIN env overrides so a future scheme change
doesn't require another SDK release.

Also fixes File silently making real HTTP requests to production CDN
during garbage collection: io.IOBase's finalizer calls close(), which
was falling through File's attribute-proxying machinery and
triggering the lazy fetcher for files that were never read. close()
is now a no-op unless the file was actually materialized, and a
failed fetch is cached instead of retried on every attribute access.

Also fixes test_job_init using asyncio.Future()/Queue() in a sync
test, which raises RuntimeError on Python 3.14 now that the implicit
event-loop-on-demand fallback is gone.

Moves the CDN config default from the retired content.timbal.ai to
timbalusercontent.com (old host stays recognized for back-compat).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Commit 2 — the docs reorg:
docs(api-reference): split Alarms, Connectors, and Evals into top-level groups

Notifications (rules + channels) has been fully replaced by the new
Alarms/Channels/Metrics endpoints in openapi.json; removed the 9 now-
orphaned notification pages that pointed at REST operations that no
longer exist.

Added docs for all new Alarms, Channels, and Metrics endpoints, plus
3 previously-undocumented connector endpoints (local-config, revoke,
syncs/run). Moved Connectors and Evals out of Organizations/Projects
into their own top-level groups, with Channels and Metrics nested
under Alarms.

Final group order: Me, Organizations, Projects, Knowledge Bases,
Evals, ACE, Alarms, Connectors.
@cursor

cursor Bot commented Jul 28, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
The Python deployment hostname change is a breaking behavior for anything still expecting proj-env-* URLs; the OpenAPI shift also documents removal of notification rules in favor of alarms, which integrators must follow.

Overview
Replaces event-based org/project notification rules with a metric-alarms model in the public API reference. openapi.json gains alarms (CRUD, health, history, channel attach/detach), org channels at /orgs/{org_id}/channels, and metrics (query, catalog, custom definitions + preview). Legacy /notifications/* rule and channel pages are removed; new Mintlify stubs under api-reference/alarms/ wire to those operations.

Connectors docs expand with local-config, revoke, and syncs/{sync_id}/run, plus richer sync/create schemas (existing_dest, adoption fields, failure/disable metadata). Navigation in docs.json moves Evals and Connectors to top-level groups and adds an Alarms section.

Python platform clients now build deployment URLs as https://e{env_id}.deployments… (not proj-env-{id}), with optional TIMBAL_PROJECT_ENV_ORIGIN and TIMBAL_DEPLOYMENTS_DOMAIN overrides; tests updated accordingly. Minor OpenAPI additions include usage n_warning and applies_to_all_envs on variables.

Reviewed by Cursor Bugbot for commit 65dc521. Bugbot is set up for automated code reviews on this repo. Configure here.

A File whose __init__ raised before _setup() (e.g. an invalid source)
leaves an object with none of its internal slots set. On Windows/py3.13
CI such objects were finalized by io.IOBase.__del__ -> close(), which
raised AttributeError reading the unset __fileobj__ slot; that became an
unraisable exception, and pytest's hook then repr()'d the object, sending
__str__ -> __getattr__ -> __wrapped__ (AttributeError) -> __getattr__ into
infinite recursion (RecursionError).

Three coordinated fixes:
- __getattr__ raises AttributeError for any name starting with "__"
  (internal slots and CPython's __IOBase_closed finalizer probe) instead
  of routing it through the lazy fetcher/__wrapped__, which is what
  recursed. Proxied file attributes (read, name, seek, ...) never start
  with "__", so real proxying is unaffected.
- close() no longer raises when __fileobj__ is unset, so finalizing a
  half-built File produces no unraisable exception.
- __str__ falls back to "File(uninitialized)" when its slots are missing,
  keeping repr() safe on any finalization/unraisable-hook path.

Adds regression tests covering repr/close of a half-constructed File and
GC of many invalid-source Files.
@berges99
berges99 merged commit 226fe78 into main Jul 28, 2026
10 checks passed
@berges99
berges99 deleted the fix/gateway-421-gc-and-docs-reorg branch July 28, 2026 10:40
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