Repository navigation
Conversation
|
`max_retries or <env>` treated 0 as "not provided", so passing max_retries=0 fell back to ROE_MAX_RETRIES or the default 3 and retries could not be turned off from code. Tested: new tests/unit/test_config.py fails before, passes after; full suite passes.
Both loops checked the deadline and then always slept a full `interval`, so wait(interval=60, timeout=1) raised after 60s. Sleep at most until the deadline, and use time.monotonic() so wall-clock changes don't affect the timeout. Tested: tests/unit/test_job_wait.py (fake clock) fails before with 60s elapsed, passes after; full suite passes.
build_execution_multipart passed the handle from FileUpload.to_multipart_tuple() to httpx, and nothing closed it, so every run with a path-based FileUpload leaked a file descriptor. Read the bytes inside a `with` block, the same way plain path strings are already handled a few lines below. Tested: tests/unit/test_inputs.py fails before (open BufferedReader returned), passes after; full suite passes.
The header was hard-coded to roe-python/0.1.0 while the package is
1.1.15, so server-side logs can't tell SDK versions apart. Use
roe.__version__ (imported lazily to avoid a circular import).
Tested: tests/unit/test_auth.py fails before ('roe-python/0.1.0'),
passes after; full suite passes.
retrieve_status_many returns only the jobs the server knows about, and JobBatch.wait skipped any it didn't get back. A deleted or mistyped job ID therefore never reached a terminal state, and wait() polled until its timeout (two hours by default) before raising TimeoutError. Raise NotFoundError naming the missing IDs on the first poll instead, as the Go SDK does. IDs are compared in canonical UUID form, so callers who pass upper-case IDs see no change. The existing batch timeout test built status items as dicts, whose IDs JobBatch can't read, so it was passing through this same path; it now uses real UUIDs and attribute-style items. Tested: new test in tests/unit/test_job_wait.py fails before (TimeoutError after the full 60s) and passes after; full suite, ruff check and ruff format --check pass.
RoeRetryTransport retried the run_async_many POST on 5xx/408/429, which can submit (and bill) a chunk up to four times. Send x-roe-skip-retry like the single-run helpers do. Fixes roe-ai#85.
A failure on a later chunk discarded the IDs of jobs already started by earlier chunks. Attach them to the exception as submitted_job_ids and re-raise it unchanged. Fixes roe-ai#87.
Non-string inputs went through str(), so {"a": "b"} reached the server as
the Python repr {'a': 'b'}. JSON-encode dicts and lists; other types are
unchanged. Part of roe-ai#86.
e5e5e43 to
70a4583
Compare
|
Rebased this PR and #90, #92, and #93 onto the latest Could you take a look when convenient? Happy to address any feedback or adjust the order of the related changes. Thanks! |
Small, independent fixes, one commit each so any can be dropped:
max_retries=0was ignored.RoeConfig.from_envusedmax_retries or <env>, so 0 fell back toROE_MAX_RETRIES/ 3.Job.wait/JobBatch.waitoverran the timeout. They always slept a fullintervalafter the deadline check, sowait(interval=60, timeout=1)raised after 60s. Now they sleep at most until the deadline and usetime.monotonic().FileUpload(path=...)agent inputs leaked a file descriptor. The handle opened byto_multipart_tuple()was never closed; read the bytes in awithblock like plain path strings already are.roe-python/0.1.0. Now usesroe.__version__.run_manychunks were retried. The transport retried the batch POST on 5xx/408/429, so one chunk could create (and bill) its jobs up to 4 times. It now sendsx-roe-skip-retrylike the single-run helpers.run_manylost job IDs when a later chunk failed. The exception now carriessubmitted_job_idsfor the jobs earlier chunks already started.{'a': 'b'}). They're now JSON-encoded; other types are unchanged.JobBatch.waithung until its timeout (2h by default) when the status response left out a job (e.g. a deleted ID). It now raisesNotFoundErrornaming the missing IDs on the first poll, like the Go SDK does.Testing
test_config.py,test_job_wait.py(fake clock),test_inputs.py,test_auth.py, plus asserts intest_agents_wrapper_transport.py. Each fails before its fix and passes after.uv run pytest,ruff check,ruff format --check.git add -fbecause.gitignorecontainstests/.Testing against the live API requires a Roe API key, so these were verified with unit tests and local mock servers only.
Fixes #87. Part of #85 (only
run_many; the create/upload POSTs are unchanged) and #86 (only dict/list encoding; plain-string file-path detection needs your call).