-
Notifications
You must be signed in to change notification settings - Fork 15
feat(triage): effort-estimation skill and auto-promotion gate #646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+1,806
−84
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
eval/triage/cases/009-effort-high-multi-component/annotations.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # This case tests the effort-estimation gate. The bug spans multiple | ||
| # components (session, auth middleware, views, rate limiter) and requires | ||
| # new test infrastructure. The agent should score effort >= 4 and set | ||
| # block_auto_promotion.blocked = true, resulting in "triaged" instead | ||
| # of "ready-to-code". | ||
| state: open | ||
|
|
||
| labels: | ||
| required: | ||
| - triaged | ||
| - bug | ||
| forbidden: | ||
| - ready-to-code | ||
|
|
||
| triage_summary: | ||
| category: bug | ||
| block_auto_promotion: | ||
| blocked: true | ||
|
|
||
| max_turns: 30 | ||
| max_cost_usd: 2.00 | ||
|
|
||
| triage_expectations: | | ||
| This issue reports a memory leak in the session store and a security | ||
| flaw where logout does not invalidate tokens. The fix touches at least | ||
| four files across two packages (auth, middleware) and requires new | ||
| test fixtures for session lifecycle. `src/api/users.py` is an unrelated | ||
| mass-assignment handler; do not count it toward scope. | ||
|
|
||
| The effort-estimation skill should score this high because: | ||
| - Scope: four files across two packages (session.py, views.py, | ||
| auth middleware, rate_limit.py) — 4. | ||
| - Testing: no existing session lifecycle tests; needs new test | ||
| infrastructure for time-dependent behavior (mocking time.time) — 4. | ||
| - Domain knowledge: requires understanding subsystem design across | ||
| the session store, auth middleware, and rate limiter — 3. | ||
| - Risk: changing session management is a breaking change affecting | ||
| every authenticated endpoint and downstream consumers; incorrect | ||
| eviction could log out active users or leave stale tokens valid — 5. | ||
|
|
||
| Overall effort should be >= 4 (average 4.0), triggering | ||
| block_auto_promotion. Risk=5 also independently triggers blocking | ||
| per the "any single dimension scores 5" rule. | ||
|
|
||
| A good triage should: | ||
|
|
||
| 1. Verify the claims against the code: confirm SESSIONS only evicts | ||
| on lookup, confirm logout_handler is a no-op, confirm RATE_LIMITS | ||
| has the same accumulation pattern. | ||
| 2. Identify this as a bug (category: bug), not security. The session | ||
| TTL is implemented but the eviction is broken, and logout is | ||
| documented but not functional. Do not split; the three symptoms | ||
| (session leak, no-op logout, rate-limiter accumulation) share the | ||
| same root cause (missing eviction/invalidation) and should be | ||
| fixed together as a single defect. | ||
| 3. Set block_auto_promotion.blocked = true with a reason citing the | ||
| multi-component scope and testing requirements. | ||
| 4. The post-script should apply "triaged" + "bug" (not "ready-to-code"). | ||
|
|
||
| Scoring guide: | ||
| A score of 1 means the agent misidentified the action or category. | ||
| A score of 3 means correct action and category but did not flag the | ||
| effort level or missed the rate_limit.py parallel issue. | ||
| A score of 5 means correct triage, verified all claims against code, | ||
| identified the cross-cutting nature, and blocked auto-promotion with | ||
| a clear reason. |
41 changes: 41 additions & 0 deletions
41
eval/triage/cases/009-effort-high-multi-component/input.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| forge: github | ||
| fixture: | ||
| type: issue | ||
| title: "Session tokens never expire in practice — memory leak and security risk" | ||
| body: | | ||
| ## Bug Report | ||
|
|
||
| **What happened:** | ||
| We noticed our production server's memory usage climbs steadily over time | ||
| and never drops. After profiling, we traced it to the in-memory `SESSIONS` | ||
| dict in `src/auth/session.py` — it grows indefinitely because expired | ||
| sessions are only removed on lookup (`get_session`), never proactively | ||
| cleaned. Tokens that are never looked up again stay in memory forever. | ||
|
|
||
| On top of the memory leak, `logout_handler` in `src/auth/views.py` does | ||
| not delete the session — the token remains valid for the full TTL even | ||
| after the user explicitly logs out. Combined with the lack of cleanup, | ||
| this means a stolen token can be used long after the user thought they | ||
| signed out. | ||
|
|
||
| **Steps to reproduce:** | ||
| 1. Start the server and log in 10,000 times (scripted). | ||
| 2. Never revisit any of those sessions. | ||
| 3. Observe `SESSIONS` dict size — it holds all 10,000 entries. | ||
| 4. Log out — the session token is still usable afterward. | ||
|
|
||
| **Expected behavior:** | ||
| - A background task or TTL-based eviction should remove expired sessions. | ||
| - `logout_handler` should invalidate the session token immediately. | ||
| - The auth middleware should stop accepting tokens after logout. | ||
|
|
||
| **Impact:** | ||
| - Production OOMs every ~3 days, requiring manual restarts. | ||
| - Security: logout does not actually invalidate access. | ||
| - Affects the rate limiter too — `RATE_LIMITS` in | ||
| `src/middleware/rate_limit.py` has the same pattern (entries accumulate | ||
| without proactive cleanup). | ||
|
|
||
| **Environment:** | ||
| - Python 3.12, single-process deployment | ||
| - ~2,000 active users, ~15,000 logins/day |
31 changes: 31 additions & 0 deletions
31
eval/triage/cases/009-effort-high-multi-component/repo/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # User Service | ||
|
|
||
| A Python web application with authentication, user management API, | ||
| rate limiting, and session management. | ||
|
|
||
| ## Architecture | ||
|
|
||
| ``` | ||
| src/ | ||
| auth/ Session management, validators, login/logout views | ||
| api/ REST endpoints for user CRUD | ||
| middleware/ Auth enforcement, rate limiting | ||
| db/ Data access layer | ||
| tests/ Unit tests | ||
| ``` | ||
|
|
||
| ## Running | ||
|
|
||
| ```bash | ||
| pip install -r requirements.txt | ||
| python -m src.main | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| Environment variables: | ||
|
|
||
| - `SESSION_TTL` — session timeout in seconds (default: 3600) | ||
| - `RATE_LIMIT_WINDOW` — rate limit window in seconds (default: 60) | ||
| - `RATE_LIMIT_MAX` — max requests per window (default: 100) | ||
| - `LOG_LEVEL` — logging verbosity (default: INFO) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.