Skip to content

codex/job-timeout-contract - #34

Merged
alain-sv merged 4 commits into
developfrom
codex/job-timeout-contract
May 11, 2026
Merged

codex/job-timeout-contract#34
alain-sv merged 4 commits into
developfrom
codex/job-timeout-contract

Conversation

@alain-sv

Copy link
Copy Markdown
Contributor

No description provided.

alain-sv added 3 commits May 11, 2026 18:36
…dels

- Introduced `release_notes_url` field in `AgentAbstract` and
  `AgentResponse` classes to store the URL for release notes
  corresponding to the agent version.- Updated
  `AgentRegistrationContract` to include the optional
  `release_notes_url` field.- Added tests to verify the inclusion of
  `release_notes_url` in agent registration information and contract
  schema.
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Expose job timeout and release notes metadata for Studio integration

✨ Enhancement 🧪 Tests

Grey Divider

Walkthroughs

Description
• Expose job timeout metadata in AgentMethod and registration contract
  - Add timeout field (defaults to 600 seconds, nullable for manual control)
  - Include is_async in registration info for Studio consumption
• Add release_notes_url field to Agent and registration models
  - Optional URL field for agent version release notes
  - Propagated through AgentAbstract, AgentResponse, and AgentRegistrationContract
• Update dependencies and development tooling
  - Bump runtime and dev dependencies to latest versions
  - Add Black formatter and yamllint to CI pipeline
• Add comprehensive test coverage for new metadata fields
Diagram
flowchart LR
  AM["AgentMethod"] -->|adds timeout field| RI["registration_info"]
  AA["AgentAbstract"] -->|adds release_notes_url| AR["AgentResponse"]
  ARC["AgentRegistrationContract"] -->|includes| RNU["release_notes_url"]
  AMC["AgentMethodContract"] -->|includes| TM["timeout + is_async"]
  RI -->|exposes to| Studio["Studio"]
  AR -->|exposes to| Studio
Loading

Grey Divider

File Changes

1. src/supervaizer/agent.py ✨ Enhancement +18/-0

Add timeout and release notes metadata to agent models

src/supervaizer/agent.py


2. src/supervaizer/contracts.py ✨ Enhancement +3/-0

Update contracts with timeout and release notes fields

src/supervaizer/contracts.py


3. tests/test_agent.py 🧪 Tests +37/-0

Add tests for timeout and release notes metadata

tests/test_agent.py


View more (7)
4. tests/test_contracts.py 🧪 Tests +10/-0

Verify timeout and release notes in contract schema

tests/test_contracts.py


5. tests/test_cli.py 🧪 Tests +9/-0

Add console fixture for consistent test output

tests/test_cli.py


6. pyproject.toml Dependencies +40/-20

Bump dependencies and add Black formatter config

pyproject.toml


7. .github/workflows/python-package.yml ⚙️ Configuration changes +7/-0

Add Black and yamllint checks to CI pipeline

.github/workflows/python-package.yml


8. .claude/skills/gitnexus/gitnexus-cli/SKILL.md 📝 Documentation +1/-0

Document drop-embeddings flag for gitnexus analyze

.claude/skills/gitnexus/gitnexus-cli/SKILL.md


9. AGENTS.md 📝 Documentation +17/-73

Update GitNexus index statistics and documentation

AGENTS.md


10. docs/CHANGELOG.md 📝 Documentation +21/-0

Document timeout metadata and dependency updates

docs/CHANGELOG.md


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented May 11, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Custom async flag misread ✓ Resolved 🐞 Bug ≡ Correctness
Description
Agent.job_start() selects a custom action when method_name != "job_start", but it still checks
self.methods.job_start.is_async to decide sync/async execution; this can execute an async custom
method via the synchronous _execute() path and raise TypeError when the coroutine is not a
JobResponse. This becomes user-visible because the PR now advertises per-method is_async in the
Studio contract/registration payload.
Code

src/supervaizer/contracts.py[R156-157]

+    is_async: bool = False
+    timeout: int | None = 600
Evidence
The PR now exposes per-method is_async in the contract/registration payload, but the runtime
dispatch in Agent.job_start() checks the job_start method’s async flag even after selecting a
custom method as action. Since _execute() calls the method directly and requires a
JobResponse, invoking an async method through this sync path produces a coroutine and triggers the
TypeError guard.

src/supervaizer/contracts.py[150-158]
src/supervaizer/agent.py[453-467]
src/supervaizer/agent.py[916-950]
src/supervaizer/agent.py[865-882]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The controller runtime decides whether to execute a method synchronously vs asynchronously using `self.methods.job_start.is_async` even when the selected method is a custom action. Now that the registration/contract exposes per-method `is_async`, Studio (or agent authors) can mark a custom method as async, but the controller may still execute it synchronously, causing `_execute()` to receive a coroutine and raise because it is not a `JobResponse`.
### Issue Context
- PR adds `is_async` to the contract and exports it in method registration info.
- `Agent.job_start()` already chooses `action = self.methods.custom[method_name]` for custom methods, but it does not use `action.is_async`.
### Fix Focus Areas
- src/supervaizer/agent.py[916-950]
- src/supervaizer/agent.py[865-882]
- src/supervaizer/contracts.py[150-158]
### Proposed fix
1. In `Agent.job_start()`, change the conditional from `if self.methods.job_start.is_async:` to `if action.is_async:`.
2. (Optional but recommended) Adjust the initial log line that currently prints `self.methods.job_start.method` so it logs `action.method` (so custom invocations log correctly).
3. Add/extend a unit test that constructs an agent with a custom method where `is_async=True` and asserts the controller takes the async branch (currently `NotImplementedError` is fine, but it should be raised based on `action.is_async`, not `job_start.is_async`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Formatter enforcement mismatch ✓ Resolved 🐞 Bug ☼ Reliability
Description
CI now runs black --check, but local pre-commit formatting is driven by ruff format and does
not run Black, so a change can pass local hooks yet fail CI due to unmet Black formatting. This
creates an inconsistent single source of truth for formatting.
Code

.github/workflows/python-package.yml[R31-32]

+      - name: Check Black formatting
+        run: uv run black --check .
Evidence
The workflow explicitly adds Black enforcement, while the repository’s pre-commit hooks format using
Ruff and do not include Black. That means local formatting compliance is not equivalent to CI
formatting compliance.

.github/workflows/python-package.yml[24-37]
.pre-commit-config.yaml[1-14]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow introduces a mandatory Black check in CI, but the repository’s pre-commit configuration formats Python with Ruff (`ruff format`) and does not run Black. This makes it possible to pass pre-commit locally and still fail CI on formatting.
### Issue Context
- CI: `uv run black --check .`
- Local hooks: `uv run ruff format --force-exclude` (no Black hook)
### Fix Focus Areas
- .github/workflows/python-package.yml[24-37]
- .pre-commit-config.yaml[1-15]
- pyproject.toml[116-135]
### Suggested resolutions (pick one)
1. **Make Black the single formatter**: add a Black hook to `.pre-commit-config.yaml` (using `uv run black ...`) so local and CI enforce the same formatter.
2. **Make Ruff the single formatter**: remove the Black CI check step and rely on Ruff formatting checks (or add a Ruff check step instead).
3. If keeping both, add documentation + a `just format`/`just lint` target that runs both so developers can reproduce CI locally.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread src/supervaizer/contracts.py
- Revised the code style section in GEMINI.md to clarify the use of `ruff` for linting and formatting.
- Removed the `black` dependency from pyproject.toml and its related configuration.
- Updated CI workflow to check `ruff` formatting instead of `black`.
- Incremented the test pass count in CHANGELOG.md.
- Enhanced the agent's job start method to utilize the correct async handling for custom methods in agent.py.
- Added tests to validate the async behavior of custom job methods in test_agent.py.
@alain-sv
alain-sv merged commit ae78b3b into develop May 11, 2026
6 checks passed
@alain-sv
alain-sv deleted the codex/job-timeout-contract branch May 13, 2026 13:18
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.

1 participant