Repository navigation
fix: bound task creation, log registry tokens - #369
Conversation
Set plugins.defaults.forward_timeout to 20 s in the base config, so that a request to create a task (attempts within forward_timeout, the last create read, then connecting to and reading the task's state) ends within 55 s with the defaults, below a 60 s proxy read timeout; test the bound and document it. Name the registries whose verified TES instances get proTES' token in the startup line of token recipients. Closes #364 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Document the paths outside the bound (registry reads, token requests, hosts with several addresses, database writes), how many unreachable TES instances fit into forward_timeout, the new default in the upgrade guide and the chart's README, and the registries in the startup log. Name the test's headroom (review). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Also name slow answers as outside the creation bound (review). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR constrains task creation to a 20-second forwarding budget so the default create-and-follow-up flow remains within a 60-second proxy timeout, while documenting timing exclusions and failover trade-offs. It also makes startup token-recipient logging include client-credential registries and adds regression coverage without logging secrets. Sequence diagram for bounded task creation forwardingsequenceDiagram
participant Client
participant ProTES
participant TES
Client->>ProTES: create_task
ProTES->>TES: create_task within forward_timeout
TES-->>ProTES: task response
ProTES->>TES: get_task
TES-->>ProTES: task state
ProTES-->>Client: create response
Note over ProTES: forward_timeout = 20s
Note over ProTES,TES: Default create/follow-up budget: 20 + 15 + 5 + 15 = 55s
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #369 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 2234 2234
=========================================
Hits 2234 2234 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="deployment/README.md" line_range="103-104" />
<code_context>
defaults of the plugin store, `defaults.store`, and `gateway_id`) are
- set in `config.plugins`.
+ set in `config.plugins`. The app's base config sets
+ `defaults.forward_timeout` to 20 seconds, so that requests to create
+ tasks end within the 60 seconds of common proxies; change it together
+ with `config.custom.tes.timeout` and the proxy's read timeout (see [TES
+ instances](https://protes.readthedocs.io/en/latest/configuration/#tes-instances)).
</code_context>
<issue_to_address>
**Proxy budget is overstated**
When a request triggers one of the extra paths excluded from the estimate, such as a due registry refresh or an identity-provider token request, a registry refresh, token request, or other excluded work adds time outside the 55-second forwarding-and-state estimate, so task creation can exceed the proxy read timeout and clients may retry a task that was already created.
Describe the 55-second figure as an estimate for forwarding and retrieving state, and qualify the shorter summaries to say that excluded work can still exceed the proxy timeout.
Also at `pro_tes/config.yaml:354-356`, `docs/upgrading.md:194-196`.
</issue_to_address>Linked issues
#364 fix: bound task creation, log registry tokens · 4 of 4 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | The startup log names registries whose instances get proTES' token. | ✅ Met | check_backends includes registry entries using client_credentials in the token-recipient log, labeled those verified by registry <url>. |
| 2 | Set the base-config forward_timeout so the combined task-creation duration stays within the 60-second proxy budget with the defaults. |
✅ Met | The base config sets forward_timeout to 20 seconds; with the 15-second TES timeout and 5-second connect timeout, the documented bound is 55 seconds. |
| 3 | Test that the defaults keep task creation within 60 seconds. | ✅ Met | test_create_task_budget checks the configured forwarding and TES timeouts against the 60-second proxy budget, leaving named headroom. |
| 4 | Document the combined task-creation bound. | ✅ Met | docs/configuration.md states the formula and default duration, and describes paths outside the bound. |
Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: deployment/README.md:104
Say that the 55 s cover forwarding and getting the task's state, and that other work can add to it (Sourcery review). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Code findings of the 0.4.0 pre-release review (#364).
plugins.defaults.forward_timeout: 20(FOCA's default: 60). Only the connect timeout of each attempt is cut to the time left; the last attempt's create read (custom.tes.timeout, 15 s) and the follow-upget_task(5 s connect + 15 s read) come on top, so with FOCA's default a request could take about 95 s, beyond the 60 s read timeout of common proxies (504, and a duplicate task on retry). With 20 s: 20 + 15 + 5 + 15 = 55 s.tests/test_app.py::test_create_task_budgetguards the defaults;docs/configuration.mddocuments the bound, what it leaves out (registry reads due in the request, token requests, hosts with several addresses, database writes) and the trade-off (fewer unreachable TES instances are tried: about 4 configured or 2 discovered);docs/plugins.md,docs/upgrading.mdand the chart's README name the new default.auth: client_credentials(those verified by registry <url>), as their verified TES instances get the same token; documented indocs/access-control.md. Test:tests/test_security.py::test_registry_tokens_logged.Closes #364
Verification
assert 95 <= 55; the log line without the registry), then passed.coverage run -m pytest: 1095 passed, 175 skipped (Helm chart tests: nohelmlocally), coverage 100%.mkdocs build --strict: passed.pre-commit run --files <changed files>(ruff, mypy, semgrep, ast-grep, gitleaks): passed.CI passed, tests on mongomock and MongoDB 7.0, chart, smoke test, docs, scan, CodeQL).Declined review findings
get_taskby a total deadline: code changes beyond this issue (the guarded client's deadline also cuts reads short, seedocs/plugins.md); documented as not covered instead. Candidates for a follow-up together with feat: limit exposure of tokens and backend URLs #366.BackendList), documented.Open questions
None for this PR. For the maintainer: 20 s trades failover depth for the proxy budget; deployments with long lists of unreliable TES instances raise it together with the proxy's timeout (documented).
🤖 Generated with Claude Code
Summary by Sourcery
Keep task creation within common proxy timeouts and make all proTES token recipients visible in startup logs.
Bug Fixes:
Enhancements:
Tests: