Repository navigation
Description
I'm an AI agent helping Engel Nyst (@enyst) with project work.
Is there an existing issue for the same bug?
- I have searched existing issues and this is not a duplicate.
Bug Description
While the projects experimental feature is off, a client can make a conversation a member of an existing project and set its server-owned tags (project, prs, resolved, resolvenote, turn, ask). It can do this by starting a conversation with project=<existing id>, or by PATCHing an existing conversation's tags.
When the user switches Projects back on, those conversations appear on the project board as members, with the faked state. In the repro below, one shows as resolved by the user, with a pull request it never opened. A client can then no longer remove the faked tags, because the conversation is now a member and the reserved keys keep their values.
While Projects is on, the same requests are refused with 422. The guards in ProjectService.member_of() return None whenever the switch is off, so they don't apply while it is off. Membership is not stored separately: it is just "the project tag names an existing project". So tags written while the switch is off become board state once it is back on.
This needs a maintainer's product decision. The off-state behavior is deliberate and tested:
RESERVED_TAG_KEYS's docstring says the reserved tags are ordinary client tags unless Projects is on.tests/agent_server/test_projects_router.py::test_with_projects_off_a_patch_sets_and_clears_the_project_keysasserts that a PATCH can setprojectand the board tags of an existing project while Projects is off.
What may not have been intended is what those tags do after the switch is turned back on. The F36 map says "only the coordinator starts members" and that the server owns these tags.
Options I see:
- Guard by project existence, not by the switch. A
projecttag that names an existing project is refused or kept on client writes (start, fork, tag PATCH) whether Projects is on or off. Off still means no routes, no tools and no wake-ups, and a tag that names no project stays ordinary. This changes the test above. - Treat off-state writes as non-membership. Record which conversations the server itself made members (a stored member list or a server-only marker), and ignore a
projecttag written by a client. - Keep the current behavior and document that turning Projects off lets clients edit membership and board state.
Expected Behavior
A client cannot add a conversation to a project, or set its board state or pull requests, by writing tags while Projects is off. This holds unless the maintainers decide on option 3.
Actual Behavior
With Projects off:
POST /api/conversationswith tagproject=<existing id>is accepted.PATCH /api/conversations/{id}{"tags": {"project": "<id>", "prs": "evil/repo#1", "resolved": "user"}}is accepted and stored.
After the switch goes back on, GET /api/projects/{id}/conversations lists both conversations:
- The patched one has
attention: "resolved",resolved: "user"andpull_requests: [{"owner": "evil", "repo": "repo", "number": 1}]. - A later client
PATCH {"tags": {"qa": "cleared"}}leavesproject,prsandresolvedin place.
Steps to Reproduce
On main@3a893a1b26de7ec02cc0dd2427906eea6aea3fc7, from the repository root:
uv sync --dev
export PATH="$PWD/.agents/skills/verify-agent-server/scripts:$PATH"
export AGENT_SERVER_VERIFY_RUN=$(control-agent-server launch --new --print-run)
control-agent-server doctor
C=control-agent-server
$C api PATCH /api/settings/experimental/projects --json '{"enabled": true}'
P=$($C api POST /api/projects --json '{"name":"qa-spoof"}' --field id)
# Control, Projects on: both are refused with 422
$C conversation start --no-run --placeholder-agent --tools none --no-autotitle --tag project=$P
CON=$($C conversation start --no-run --placeholder-agent --tools none --no-autotitle --tag qa=on --print-id | tail -1)
$C api PATCH /api/conversations/$CON --json "{\"tags\":{\"qa\":\"on\",\"project\":\"$P\",\"prs\":\"evil/repo#1\",\"resolved\":\"user\"}}" --expect 422
# Projects off: both are accepted
$C api PATCH /api/settings/experimental/projects --json '{"enabled": false}'
A=$($C conversation start --no-run --placeholder-agent --tools none --no-autotitle --tag project=$P --print-id | tail -1)
B=$($C conversation start --no-run --placeholder-agent --tools none --no-autotitle --tag qa=off --print-id | tail -1)
$C api PATCH /api/conversations/$B --json "{\"tags\":{\"qa\":\"off\",\"project\":\"$P\",\"prs\":\"evil/repo#1\",\"resolved\":\"user\"}}" --expect 200
# Projects on again: both are members, with the faked board state
$C api PATCH /api/settings/experimental/projects --json '{"enabled": true}'
$C api GET /api/projects/$P/conversations
$C api PATCH /api/conversations/$B --json '{"tags":{"qa":"cleared"}}'
$C api GET /api/conversations/$B --field tags # project, prs and resolved are still there
control-agent-server stopA second agent reproduced this independently on two more fresh runs (F36.flag-spoof in the evidence below).
Installation Method
From source (uv sync --dev)
SDK Version
main@3a893a1b26de7ec02cc0dd2427906eea6aea3fc7 (agent server reports 1.63.1)
Version Confirmation
- I have confirmed this bug exists on the LATEST version of OpenHands SDK
Python Version
3.13
Model Name (if applicable)
None: no model is called.
Operating System
Linux
Logs and Error Messages
The refusals with Projects on:
- start:
422 {"detail": "A project's conversations are started by its coordinator; leave out the 'project' tag"} - PATCH:
422 {"detail": "A conversation joins a project only when the project's coordinator starts it"}
Minimal Code Sample
See Steps to Reproduce.
Evidence and Additional Context
- Not a regression: Projects and its switch arrived in feat(agent-server): projects API, coordinator tools, board groups and artifacts #6602, which is in this range. Projects board: failed judge asks the user, remove clears board tags, coordinator never auto-resolves #7038 and feat(projects): record the pull requests a project member opens #6922 added the board tags and
prson top of it. - Found by the daily verify-agent-server map pass (F36,
projectsswitch). Bullets:F36.flag-off,F36.client-tags. - Evidence (round 1 of the independent repro), pinned to evidence commit 808e4ed:
- [README](
https://github.com/enyst/openhands-evidence/blob/808e4ed19fbb33f4aced8af7867f97d168de7b86/software-agent-sdk/bugs/2026-11-21/projects-tags-while-off/README.md) - [script](
https://github.com/enyst/openhands-evidence/blob/808e4ed19fbb33f4aced8af7867f97d168de7b86/software-agent-sdk/bugs/2026-11-21/projects-tags-while-off/round.sh)and [full output](https://github.com/enyst/openhands-evidence/blob/808e4ed19fbb33f4aced8af7867f97d168de7b86/software-agent-sdk/bugs/2026-11-21/projects-tags-while-off/round1.log) - [PATCH accepted while off](
https://github.com/enyst/openhands-evidence/blob/808e4ed19fbb33f4aced8af7867f97d168de7b86/software-agent-sdk/bugs/2026-11-21/projects-tags-while-off/round1/11-off-patch-tags.json) - [board after the switch is back on](
https://github.com/enyst/openhands-evidence/blob/808e4ed19fbb33f4aced8af7867f97d168de7b86/software-agent-sdk/bugs/2026-11-21/projects-tags-while-off/round1/14-on-project-conversations.json) - [faked tags kept after a client PATCH](
https://github.com/enyst/openhands-evidence/blob/808e4ed19fbb33f4aced8af7867f97d168de7b86/software-agent-sdk/bugs/2026-11-21/projects-tags-while-off/round1/19-on-get-B-after-clear.json)
- [README](
- Code:
ProjectService.member_of()andupdate_conversation_from_client()inopenhands-agent-server/openhands/agent_server/project_service.py, and_refuse_project_member()inconversation_router.py.
Generated by Claude Code
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
Ready for development. With the projects experimental switch off, ProjectService.member_of() returns None, so the existing 422 guards in _refuse_project_member() and update_conversation_from_client() do not apply; a project tag naming an existing project is accepted on start, fork, and tag PATCH, and board tags written while off become live board state when Projects is switched back on. Scope is bounded to gating client tag writes on project existence: option 1 in the report, which follows the F36 rule that only the coordinator starts members and that the server owns the reserved keys. Non-goals: no storage change for off-state writes (option 2), no change to the off-state routes, tools, or wake-up behavior, no backfill or repair of tags written while Projects was off, no changes outside openhands-agent-server (including clients/typescript/, which is updated by the OpenAPI contract as needed), and no new product surface beyond the two 422 error messages already used with Projects on.
Acceptance Criteria
- With Projects off,
POST /api/conversationswith aprojecttag naming an existing project answers 422 with the existing message "A project's conversations are started by its coordinator; leave out the 'project' tag", matching the refusal already in force with Projects on. - With Projects off,
POST /api/conversations/{id}/forkwith aprojecttag naming an existing project answers 422 with the same message. - With Projects off, a
PATCH /api/conversations/{id}whose tags would make the conversation a member of an existing project answers 422 with the existing message "A conversation joins a project only when the project's coordinator starts it". - With Projects off, a
PATCHon a conversation whoseprojecttag already names an existing project keepsproject,turn,ask,resolved,resolvenote, andprsat their current values and applies only the client's other tags, as_client_tagsdoes with Projects on. - A
projecttag that names no existing project stays an ordinary client tag on start, fork, and PATCH, whether Projects is on or off. - After switching Projects from off to on,
GET /api/projects/{id}/conversationslists only conversations the server made members (the coordinator and the conversations it started), with the board state the server wrote. -
tests/agent_server/test_projects_router.py::test_with_projects_off_a_patch_sets_and_clears_the_project_keysis updated to the new off-state behavior, and a regression test covers the off → on sequence above (client membership and board-tag writes refused while off, no member appears after switching on). -
uv run pytest tests/agent_server/test_projects_router.pypasses with the updated tests.
Activity