Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
aa20582
test(e2e): add agent v2 core coverage
lyzno1 Jun 30, 2026
704f007
test(e2e): cover agent v2 service api access flow
lyzno1 Jun 30, 2026
5f10acc
test(e2e): centralize resource naming
lyzno1 Jul 1, 2026
b9b1c68
test(e2e): add basic configured agent fixture
lyzno1 Jul 1, 2026
7a5800e
test(e2e): add agent builder file fixtures
lyzno1 Jul 1, 2026
16837cf
test(e2e): add agent builder preflight resources
lyzno1 Jul 1, 2026
12191c2
test(e2e): add scenario cleanup registry
lyzno1 Jul 1, 2026
baa5c67
test(e2e): add agent configure autosave wait
lyzno1 Jul 1, 2026
0ac64fc
docs(e2e): document agent builder fixture boundaries
lyzno1 Jul 1, 2026
81c96a0
style(e2e): format check output
lyzno1 Jul 1, 2026
833990b
test(e2e): expose generated agent builder fixtures
lyzno1 Jul 1, 2026
25bd0f9
test(e2e): add typed cleanup for agent builder resources
lyzno1 Jul 1, 2026
45525aa
test(e2e): verify agent builder stable model preflight
lyzno1 Jul 1, 2026
4432ce1
test(e2e): add agent builder resource preflight steps
lyzno1 Jul 1, 2026
6b201b3
style(e2e): format agent builder support files
lyzno1 Jul 1, 2026
aa0e439
test(e2e): add agent builder tool preflight
lyzno1 Jul 1, 2026
ea5e00c
test(e2e): add agent builder broken model preflight
lyzno1 Jul 1, 2026
79750c5
test(e2e): add agent attached resource preflight
lyzno1 Jul 1, 2026
33dfaf8
test(e2e): add agent builder tool cleanup contract
lyzno1 Jul 1, 2026
ccacfdb
test(e2e): align package check with eslint
lyzno1 Jul 1, 2026
a759264
test(e2e): add stable model agent fixture
lyzno1 Jul 1, 2026
8ee203c
test(e2e): require active stable agent model
lyzno1 Jul 1, 2026
29d14f4
test(e2e): add agent builder preflight feature
lyzno1 Jul 1, 2026
3cd774d
test(e2e): verify agent builder dataset readiness
lyzno1 Jul 1, 2026
cdfda39
test(e2e): verify agent builder web app readiness
lyzno1 Jul 1, 2026
68e5219
test(e2e): verify agent builder workflow references
lyzno1 Jul 1, 2026
4d72a8e
test(e2e): verify agent builder file tree readiness
lyzno1 Jul 1, 2026
5744ed0
chore(e2e): restore package check script
lyzno1 Jul 1, 2026
690ecf5
style(e2e): format package with vp check
lyzno1 Jul 1, 2026
4401b1b
test(e2e): verify agent builder full config readiness
lyzno1 Jul 1, 2026
3d08182
Merge remote-tracking branch 'origin/main' into codex/agent-v2-core-e2e
lyzno1 Jul 1, 2026
9e9288f
test(e2e): verify agent builder tool state readiness
lyzno1 Jul 1, 2026
79505bf
test(e2e): verify agent builder dual retrieval readiness
lyzno1 Jul 1, 2026
fd3d984
chore(e2e): align package with root lint
lyzno1 Jul 1, 2026
f8646a8
test(e2e): verify agent file upload persistence
lyzno1 Jul 1, 2026
b2bfa9f
Merge remote-tracking branch 'origin/main' into codex/agent-v2-core-e2e
lyzno1 Jul 1, 2026
0ddcf53
fix(web): keep agent access cards within viewport
lyzno1 Jul 1, 2026
36c9baa
test(e2e): cover agent env editor persistence
lyzno1 Jul 1, 2026
a52c5c8
fix(agent-v2): report invalid env imports
lyzno1 Jul 1, 2026
16d00bd
test(e2e): verify build draft isolation
lyzno1 Jul 1, 2026
362cc31
fix(web): remove unused agent env parser export
lyzno1 Jul 1, 2026
f64d594
Merge remote-tracking branch 'origin/main' into codex/agent-v2-core-e2e
lyzno1 Jul 1, 2026
01055f9
test(e2e): improve api startup diagnostics
lyzno1 Jul 1, 2026
dae2c1d
test(e2e): cover build draft apply path
lyzno1 Jul 1, 2026
90a7a0f
test(e2e): enforce e2e resource names
lyzno1 Jul 1, 2026
740c4eb
test(e2e): cover agent v2 output variables
lyzno1 Jul 1, 2026
ac495eb
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 1, 2026
4774214
test(e2e): verify agent lifecycle preflight
lyzno1 Jul 1, 2026
30c7db7
test(e2e): cover agent advanced settings entries
lyzno1 Jul 1, 2026
969bdd8
test(e2e): cover agent env imports
lyzno1 Jul 1, 2026
764f971
test(e2e): cover agent env deletion
lyzno1 Jul 1, 2026
35e577a
test(e2e): cover agent special filename upload
lyzno1 Jul 1, 2026
a7bd1b1
test(e2e): rebuild web when sources change
lyzno1 Jul 1, 2026
6b65823
fix(agent-v2): expose configure autosave status
lyzno1 Jul 1, 2026
eca1d60
test(e2e): cover agent prompt autosave
lyzno1 Jul 1, 2026
f5b42f5
test(e2e): require runnable agent for publish
lyzno1 Jul 1, 2026
4b7fb60
test(e2e): cover agent tool states display
lyzno1 Jul 1, 2026
be6bf18
test(e2e): cover agent edit saved configuration
lyzno1 Jul 1, 2026
c98c51d
test(e2e): cover agent build draft generation
lyzno1 Jul 1, 2026
556f55e
test(e2e): verify agent skill fixture upload
lyzno1 Jul 1, 2026
f4e1b32
test(e2e): cover agent workflow access references
lyzno1 Jul 1, 2026
15af401
test(e2e): mark agent content moderation preflight
lyzno1 Jul 1, 2026
d1a2fd1
test(e2e): mark build tool writeback blocked
lyzno1 Jul 1, 2026
782f633
Merge branch 'main' into codex/agent-v2-core-e2e
lyzno1 Jul 1, 2026
d72bb98
test(e2e): mark standalone output variables blocked
lyzno1 Jul 1, 2026
d32050b
fix(workflow): avoid nested node header buttons
lyzno1 Jul 1, 2026
6ce486a
fix(agent-v2): preserve compact publish bar layout
lyzno1 Jul 1, 2026
c8e6ff3
fix(agent-v2): show build draft env changes
lyzno1 Jul 1, 2026
daeecef
test(e2e): cover build draft supported config
lyzno1 Jul 1, 2026
93a0ee3
test(e2e): clean build draft config uploads
lyzno1 Jul 1, 2026
56075da
test(e2e): clean agent config skills
lyzno1 Jul 1, 2026
a7a2ae8
test(e2e): cover build draft skill dedupe
lyzno1 Jul 1, 2026
efa2256
test(e2e): cover build draft navigation retention
lyzno1 Jul 1, 2026
8d800e7
test(e2e): cover build draft discard isolation
lyzno1 Jul 1, 2026
dcd635d
test(e2e): align file scenarios with runnable agents
lyzno1 Jul 1, 2026
8f5fbb5
test(e2e): align advanced settings with runnable agents
lyzno1 Jul 1, 2026
4c393c0
test(e2e): assert persisted agent model config
lyzno1 Jul 1, 2026
413a509
test(e2e): open access point overview from roster
lyzno1 Jul 1, 2026
7ee9af4
Merge branch 'main' into codex/agent-v2-core-e2e
lyzno1 Jul 1, 2026
ddf8141
test(e2e): cover web app access actions
lyzno1 Jul 1, 2026
e5faacc
test(e2e): namespace agent builder world state
lyzno1 Jul 1, 2026
f408fc1
test(e2e): cover web app access restore
lyzno1 Jul 1, 2026
1d93b7c
test(e2e): cover current flat agent files
lyzno1 Jul 1, 2026
6ae0839
test(e2e): cover dual retrieval settings
lyzno1 Jul 1, 2026
e17f924
test(e2e): simplify advanced settings precondition
lyzno1 Jul 1, 2026
7ea2a42
test(e2e): simplify env editor preconditions
lyzno1 Jul 1, 2026
f140a73
Merge branch 'main' into codex/agent-v2-core-e2e
lyzno1 Jul 1, 2026
2b8a80c
test(e2e): split agent builder glue
lyzno1 Jul 1, 2026
3a5dff0
docs(e2e): scope agent v2 guidance
lyzno1 Jul 1, 2026
2739772
fix(ui): name content moderation switches
lyzno1 Jul 1, 2026
0670aee
test(e2e): gate content moderation settings coverage
lyzno1 Jul 1, 2026
80171d0
test(e2e): cover agent v2 publish state
lyzno1 Jul 1, 2026
2a73e3a
refactor(e2e): scope agent v2 support
lyzno1 Jul 1, 2026
bbd998b
fix(api): type agent build draft schema
lyzno1 Jul 1, 2026
52c7e76
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 1, 2026
11c52dd
test(e2e): use generated agent api contracts
lyzno1 Jul 1, 2026
8f4155d
test(e2e): cover empty agent file upload
lyzno1 Jul 1, 2026
5c68a16
test(e2e): cover workflow agent console navigation
lyzno1 Jul 1, 2026
ab57634
test(e2e): cover missing agent tool search
lyzno1 Jul 1, 2026
119fac3
test(e2e): tighten agent contract type boundary
lyzno1 Jul 1, 2026
d1f21b2
test(e2e): cover configure leave autosave protection
lyzno1 Jul 1, 2026
3116ca3
test(e2e): standardize agent v2 blocked messages
lyzno1 Jul 1, 2026
9ff5f79
test(e2e): tighten agent edit console navigation
lyzno1 Jul 1, 2026
0c3a4d4
test(e2e): cover agent web app publish runtime
lyzno1 Jul 1, 2026
2e5aec2
test(e2e): cover agent duplicate lifecycle
lyzno1 Jul 1, 2026
f75dd9b
test(e2e): cover agent version restore
lyzno1 Jul 1, 2026
558ada7
test(e2e): cover concurrent agent edits
lyzno1 Jul 1, 2026
c427f52
test(e2e): cover backend api access recovery
lyzno1 Jul 1, 2026
321d9ad
test(e2e): cover knowledge reference removal
lyzno1 Jul 1, 2026
b92052d
test(e2e): cover nested agent output variables
lyzno1 Jul 1, 2026
74cd2d0
test(e2e): mark output retry controls blocked
lyzno1 Jul 1, 2026
791595e
test(e2e): cover agent output prompt references
lyzno1 Jul 1, 2026
c9e9448
test(e2e): remove model preflight from agent file uploads
lyzno1 Jul 1, 2026
bc18530
test(e2e): remove model preflight from prompt leave guard
lyzno1 Jul 1, 2026
86c666a
test(e2e): remove model preflight from build draft isolation
lyzno1 Jul 1, 2026
177ebce
test(e2e): mark agent file limit cases blocked
lyzno1 Jul 1, 2026
1c48225
docs(e2e): document agent file limit gates
lyzno1 Jul 1, 2026
8a7a9be
test(e2e): align stable model preflight contract
lyzno1 Jul 1, 2026
c06369f
test(e2e): default agent stable model selector
lyzno1 Jul 1, 2026
37d1be4
docs(e2e): clarify agent skill seed contract
lyzno1 Jul 1, 2026
5ad75e9
test(e2e): separate web app runtime from core publish suite
lyzno1 Jul 1, 2026
20d31dd
test(e2e): cover web app draft isolation
lyzno1 Jul 1, 2026
0f2fcd6
test(e2e): keep feature-gated scenarios outside core tags
lyzno1 Jul 1, 2026
726821e
test(e2e): tag service api runtime separately
lyzno1 Jul 1, 2026
6f2bd98
docs(e2e): document agent v2 tag taxonomy
lyzno1 Jul 1, 2026
d9c0536
docs(e2e): align cucumber playwright skill
lyzno1 Jul 1, 2026
e90c03a
docs(e2e): document single runner constraint
lyzno1 Jul 1, 2026
c9b548f
test(e2e): gate blocked agent v2 scenarios earlier
lyzno1 Jul 1, 2026
af5ea20
test(e2e): split agent access point steps
lyzno1 Jul 1, 2026
5946b24
test(e2e): clean uploaded agent drive skills
lyzno1 Jul 1, 2026
b90422f
test(e2e): split agent advanced settings steps
lyzno1 Jul 1, 2026
f116099
test(e2e): gate build unavailable resource recovery
lyzno1 Jul 1, 2026
46abc34
test(e2e): cover agent roster creation
lyzno1 Jul 1, 2026
c834424
docs(e2e): align lint command
lyzno1 Jul 1, 2026
0272ffb
test(e2e): split agent access support
lyzno1 Jul 1, 2026
e05048e
test(e2e): align stable model selector
lyzno1 Jul 1, 2026
2f8665a
test(e2e): cover agent model selection persistence
lyzno1 Jul 1, 2026
104ce27
test(web): cover embedded web app dialog close
lyzno1 Jul 1, 2026
d90575e
test(e2e): isolate agent web app access scenarios
lyzno1 Jul 1, 2026
fe99a35
docs(e2e): clarify preflight seed ownership
lyzno1 Jul 1, 2026
fb7bfd3
test(e2e): cover agent knowledge retrieval settings
lyzno1 Jul 1, 2026
badad45
fix(web): make tool action rows accessible
lyzno1 Jul 1, 2026
a684ae7
test(e2e): cover agent tool configuration persistence
lyzno1 Jul 1, 2026
1cd94be
test(e2e): split agent service api access scenarios
lyzno1 Jul 1, 2026
25ef41f
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 1, 2026
2929066
test(e2e): split agent builder support helpers
lyzno1 Jul 1, 2026
237fc8a
test(e2e): cover advanced settings collapse state
lyzno1 Jul 1, 2026
945d524
test(e2e): move output variable steps to owner file
lyzno1 Jul 1, 2026
e525176
test(e2e): avoid failure artifacts for skipped scenarios
lyzno1 Jul 1, 2026
43d2cfa
test(e2e): document skipped preflight reporting
lyzno1 Jul 1, 2026
ad6dbc3
test(e2e): verify published web app launch
lyzno1 Jul 1, 2026
eb1d363
test(e2e): assert web app entrypoints keep orchestration
lyzno1 Jul 1, 2026
c78e1c7
test(e2e): verify generated api key copy feedback
lyzno1 Jul 1, 2026
f8fad1d
test(e2e): verify api reference link target
lyzno1 Jul 1, 2026
12270f2
test(e2e): assert build draft keeps tools isolated
lyzno1 Jul 1, 2026
54740ff
test(e2e): tag stable model dependent scenarios
lyzno1 Jul 1, 2026
038ed9a
test(e2e): tag agent builder fixture dependencies
lyzno1 Jul 1, 2026
51ea38d
test(e2e): narrow agent builder fixture tags
lyzno1 Jul 1, 2026
2eec6e3
test(e2e): read agent config files from current contract
lyzno1 Jul 1, 2026
6b1a638
test(e2e): verify agent builder skill seed contracts
lyzno1 Jul 1, 2026
b1702c6
test(e2e): remove unused preview prompt fixture
lyzno1 Jul 1, 2026
10da917
test(e2e): verify knowledge seed content token
lyzno1 Jul 1, 2026
bbedadc
test(e2e): align stable model seed selector
lyzno1 Jul 1, 2026
1f339d6
docs(e2e): clarify workflow node model preflight
lyzno1 Jul 1, 2026
662d71a
test(e2e): clean workflow apps before agents
lyzno1 Jul 1, 2026
892fb22
test(e2e): report typed cleanup failures
lyzno1 Jul 1, 2026
9c0a891
test(e2e): clarify content moderation blocker
lyzno1 Jul 1, 2026
22dcd48
docs(e2e): clarify preflight seed boundary
lyzno1 Jul 1, 2026
ec68f27
test(e2e): decouple web app launch from model seed
lyzno1 Jul 1, 2026
5c1847a
test(e2e): split web app disabled access coverage
lyzno1 Jul 1, 2026
94a408d
docs(e2e): document build draft model boundary
lyzno1 Jul 1, 2026
242449f
test(e2e): improve build draft apply diagnostics
lyzno1 Jul 1, 2026
19a845f
test(e2e): expose agent tool runtime gap
lyzno1 Jul 1, 2026
e193821
test(e2e): prioritize tool runtime blocker
lyzno1 Jul 1, 2026
e00b7b3
docs(e2e): clarify blocked preflight ordering
lyzno1 Jul 1, 2026
3c58625
test(e2e): split backend api access toggle coverage
lyzno1 Jul 1, 2026
3630c42
test(e2e): verify existing backend api keys stay masked
lyzno1 Jul 1, 2026
ed7f857
docs(e2e): clarify ui availability blockers
lyzno1 Jul 1, 2026
a43da8e
test(e2e): move access point publish setup
lyzno1 Jul 1, 2026
f9e24d0
test(e2e): mark web app api setup as given
lyzno1 Jul 1, 2026
cbddfac
test(e2e): mark publish web app setup as given
lyzno1 Jul 1, 2026
73f9268
test(e2e): group publish web app setup
lyzno1 Jul 1, 2026
bb322e1
test(e2e): assert build draft skill isolation
lyzno1 Jul 1, 2026
571d9e3
test(e2e): cover knowledge retrieval runtime
lyzno1 Jul 1, 2026
4ad6255
test(e2e): keep knowledge api setup as precondition
lyzno1 Jul 1, 2026
0a40834
test(e2e): clarify configure leave scenario
lyzno1 Jul 1, 2026
2a873c7
test(e2e): split backend api runtime success
lyzno1 Jul 1, 2026
fa8c70b
docs(e2e): clarify agent builder seed boundary
lyzno1 Jul 1, 2026
5a832c5
test(e2e): keep preview scenarios opt-in
lyzno1 Jul 1, 2026
8ad9022
test(e2e): cover published web app response
lyzno1 Jul 1, 2026
ab5e9f4
test(e2e): make web app close explicit
lyzno1 Jul 1, 2026
7799869
Merge branch 'main' into codex/agent-v2-core-e2e
lyzno1 Jul 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .agents/skills/e2e-cucumber-playwright/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Write, update, or review Dify end-to-end tests under `e2e/` that us

# Dify E2E Cucumber + Playwright

Use this skill for Dify's repository-level E2E suite in `e2e/`. Use [`e2e/AGENTS.md`](../../../e2e/AGENTS.md) as the canonical guide for local architecture and conventions, then apply Playwright/Cucumber best practices only where they fit the current suite.
Use this skill for Dify's repository-level E2E suite in `e2e/`. Use [`e2e/AGENTS.md`](../../../e2e/AGENTS.md) as the canonical package guide for local architecture and conventions, then read any feature-scoped `AGENTS.md` that owns the target area. Apply Playwright/Cucumber best practices only where they fit the current suite.

## Scope

Expand All @@ -25,6 +25,8 @@ Use this skill for Dify's repository-level E2E suite in `e2e/`. Use [`e2e/AGENTS
4. Read [`references/cucumber-best-practices.md`](references/cucumber-best-practices.md) only when scenario wording, step granularity, tags, or expression design are involved.
5. Re-check official Playwright or Cucumber docs with the available documentation tools before introducing a new framework pattern.

Keep this skill focused on Cucumber, Playwright, and package-level E2E guidance. Put feature-specific conventions in the owning feature's `AGENTS.md` instead of adding them here.

## Local Rules

- `e2e/` uses Cucumber for scenarios and Playwright as the browser layer.
Expand Down Expand Up @@ -59,7 +61,7 @@ Use this skill for Dify's repository-level E2E suite in `e2e/`. Use [`e2e/AGENTS
- Do not use `waitForTimeout`, manual polling, or raw visibility checks when a locator action or retrying assertion already expresses the behavior.
5. Validate narrowly.
- Run the narrowest tagged scenario or flow that exercises the change.
- Run `pnpm -C e2e check`.
- Run `vpr lint --fix --quiet` from the repository root and `pnpm -C e2e type-check`.
- Broaden verification only when the change affects hooks, tags, setup, or shared step semantics.

## Review Checklist
Expand Down
16 changes: 10 additions & 6 deletions api/controllers/console/agent/roster.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
)
from extensions.ext_database import db
from fields.agent_fields import (
AgentConfigDraftSummaryResponse,
AgentConfigSnapshotDetailResponse,
AgentConfigSnapshotListResponse,
AgentConfigSnapshotRestoreResponse,
AgentConfigSnapshotSummaryResponse,
AgentInviteOptionsResponse,
AgentLogListResponse,
AgentLogMessageListResponse,
Expand All @@ -50,11 +52,13 @@
AgentRosterListResponse,
AgentStatisticSummaryEnvelopeResponse,
)
from fields.base import ResponseModel
from libs.datetime_utils import parse_time_range
from libs.helper import dump_response
from libs.login import login_required
from models import Account
from models.agent import Agent, AgentStatus
from models.agent_config_entities import AgentSoulConfig
from models.enums import ApiTokenType
from models.model import ApiToken, App, IconType
from services.agent.composer_service import AgentComposerService
Expand Down Expand Up @@ -264,21 +268,21 @@
version_note: str | None = Field(default=None, description="Optional note for this published Agent version")


class AgentPublishResponse(BaseModel):
class AgentPublishResponse(ResponseModel):
result: str
active_config_snapshot_id: str
active_config_snapshot: dict[str, object] | None = None
draft: dict[str, object] | None = None
active_config_snapshot: AgentConfigSnapshotSummaryResponse | None = None
draft: AgentConfigDraftSummaryResponse | None = None


class AgentBuildDraftCheckoutPayload(BaseModel):
force: bool = Field(default=False, description="Overwrite the existing current-user build draft")


class AgentBuildDraftResponse(BaseModel):
class AgentBuildDraftResponse(ResponseModel):
variant: str
draft: dict[str, object]
agent_soul: dict[str, object]
draft: AgentConfigDraftSummaryResponse
agent_soul: AgentSoulConfig


class AgentBuildDraftApplyResponse(BaseModel):
Expand Down Expand Up @@ -353,7 +357,7 @@

app_model = AppService().get_app(app_model)
if FeatureService.get_system_features().webapp_auth.enabled:
app_setting = EnterpriseService.WebAppAuth.get_app_access_mode_by_id(app_id=str(app_model.id))

Check warning on line 360 in api/controllers/console/agent/roster.py

View workflow job for this annotation

GitHub Actions / Style Check / Python Style

Pyrefly unnecessary-type-conversion

Unnecessary `str()` call; argument is already of type `str`
app_model.access_mode = app_setting.access_mode # type: ignore[attr-defined]

roster_service = _agent_roster_service()
Expand All @@ -367,7 +371,7 @@
)
)
if agent_id
else roster_service.get_app_backing_agent(tenant_id=app_model.tenant_id, app_id=str(app_model.id))

Check warning on line 374 in api/controllers/console/agent/roster.py

View workflow job for this annotation

GitHub Actions / Style Check / Python Style

Pyrefly unnecessary-type-conversion

Unnecessary `str()` call; argument is already of type `str`
)
if not agent:
raise AgentNotFoundError()
Expand Down Expand Up @@ -473,7 +477,7 @@
def _serialize_agent_api_access(app_model: App) -> dict:
base_url = app_model.api_base_url
response = AgentApiAccessResponse(
enabled=bool(app_model.enable_api),

Check warning on line 480 in api/controllers/console/agent/roster.py

View workflow job for this annotation

GitHub Actions / Style Check / Python Style

Pyrefly unnecessary-type-conversion

Unnecessary `bool()` call; argument is already of type `bool`
service_api_base_url=base_url,
chat_endpoint=f"{base_url}/chat-messages",
stop_endpoint=f"{base_url}/chat-messages/{{task_id}}/stop",
Expand All @@ -485,7 +489,7 @@
meta_endpoint=f"{base_url}/meta",
api_rpm=app_model.api_rpm or 0,
api_rph=app_model.api_rph or 0,
api_key_count=_agent_api_key_count(str(app_model.id)),

Check warning on line 492 in api/controllers/console/agent/roster.py

View workflow job for this annotation

GitHub Actions / Style Check / Python Style

Pyrefly unnecessary-type-conversion

Unnecessary `str()` call; argument is already of type `str`
)
return response.model_dump(mode="json")

Expand Down Expand Up @@ -827,7 +831,7 @@
@with_current_tenant_id
def get(self, tenant_id: str, agent_id: UUID) -> dict[str, object]:
app_model = _resolve_agent_app_model(tenant_id=tenant_id, agent_id=agent_id)
return dump_response(ApiKeyList, self._get_api_key_list(str(app_model.id), tenant_id))

Check warning on line 834 in api/controllers/console/agent/roster.py

View workflow job for this annotation

GitHub Actions / Style Check / Python Style

Pyrefly unnecessary-type-conversion

Unnecessary `str()` call; argument is already of type `str`

@console_ns.response(201, "Agent service API key created", console_ns.models[ApiKeyItem.__name__])
@console_ns.response(400, "Maximum keys exceeded")
Expand All @@ -836,7 +840,7 @@
@rbac_permission_required(RBACResourceScope.APP, RBACPermission.APP_RELEASE_AND_VERSION)
def post(self, tenant_id: str, agent_id: UUID) -> tuple[dict[str, object], int]:
app_model = _resolve_agent_app_model(tenant_id=tenant_id, agent_id=agent_id)
return dump_response(ApiKeyItem, self._create_api_key(str(app_model.id), tenant_id)), 201

Check warning on line 843 in api/controllers/console/agent/roster.py

View workflow job for this annotation

GitHub Actions / Style Check / Python Style

Pyrefly unnecessary-type-conversion

Unnecessary `str()` call; argument is already of type `str`


@console_ns.route("/agent/<uuid:agent_id>/api-keys/<uuid:api_key_id>")
Expand All @@ -851,7 +855,7 @@
@rbac_permission_required(RBACResourceScope.APP, RBACPermission.APP_RELEASE_AND_VERSION)
def delete(self, tenant_id: str, current_user: Account, agent_id: UUID, api_key_id: UUID) -> tuple[str, int]:
app_model = _resolve_agent_app_model(tenant_id=tenant_id, agent_id=agent_id)
self._delete_api_key(str(app_model.id), str(api_key_id), tenant_id, current_user)

Check warning on line 858 in api/controllers/console/agent/roster.py

View workflow job for this annotation

GitHub Actions / Style Check / Python Style

Pyrefly unnecessary-type-conversion

Unnecessary `str()` call; argument is already of type `str`
return "", 204


Expand Down
8 changes: 4 additions & 4 deletions api/openapi/markdown/console-openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -13080,8 +13080,8 @@ default (the config form sends the full desired feature state on save).

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| agent_soul | object | | Yes |
| draft | object | | Yes |
| agent_soul | [AgentSoulConfig](#agentsoulconfig) | | Yes |
| draft | [AgentConfigDraftSummaryResponse](#agentconfigdraftsummaryresponse) | | Yes |
| variant | string | | Yes |

#### AgentCliToolAuthorizationStatus
Expand Down Expand Up @@ -14156,9 +14156,9 @@ section may be empty, which is how callers express "no knowledge layer".

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| active_config_snapshot | object | | No |
| active_config_snapshot | [AgentConfigSnapshotSummaryResponse](#agentconfigsnapshotsummaryresponse) | | No |
| active_config_snapshot_id | string | | Yes |
| draft | object | | No |
| draft | [AgentConfigDraftSummaryResponse](#agentconfigdraftsummaryresponse) | | No |
| result | string | | Yes |

#### AgentPublishedReferenceResponse
Expand Down
1 change: 1 addition & 0 deletions e2e/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ playwright-report/
test-results/
cucumber-report/
.logs/
.generated-test-materials/
52 changes: 35 additions & 17 deletions e2e/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ Install Playwright browsers once:
```bash
pnpm install
pnpm -C e2e e2e:install
pnpm -C e2e check
```

`pnpm install` is resolved through the repository workspace and uses the shared root lockfile plus `pnpm-workspace.yaml`.

Use `pnpm -C e2e check` as the default local verification step after editing E2E TypeScript, Cucumber support code, or feature glue. It runs formatting, linting, and type checks for this package.
Run only one `pnpm -C e2e e2e*` process against a local workspace at a time. Separate runner processes share the frontend port, backend port, auth bootstrap state, and log paths; running them in parallel can create startup or authorization failures that are not scenario failures.

Use root lint plus the package type check as the default local verification step after editing E2E TypeScript, Cucumber support code, or feature glue:

```bash
vpr lint --fix --quiet
pnpm -C e2e type-check
```

Common commands:

Expand Down Expand Up @@ -68,8 +74,8 @@ flowchart TD
C --> D["Cucumber loads config, steps, and support modules"]
D --> E["BeforeAll bootstraps shared auth state via /install"]
E --> F{"Which command is running?"}
F -->|`pnpm -C e2e e2e`| G["Run config default tags: not @fresh and not @skip"]
F -->|`pnpm -C e2e e2e:full*`| H["Override tags to not @skip"]
F -->|`pnpm -C e2e e2e`| G["Run config default tags: not @fresh and not @skip and not @preview"]
F -->|`pnpm -C e2e e2e:full*`| H["Override tags to not @skip and not @preview"]
G --> I["Per-scenario BrowserContext from shared browser"]
H --> I
I --> J["Failure artifacts written to cucumber-report/artifacts"]
Expand Down Expand Up @@ -99,7 +105,7 @@ Behavior depends on instance state:
- uninitialized instance: completes install and stores authenticated state
- initialized instance: signs in and reuses authenticated state

Because of that, the `@fresh` install scenario only runs in the `pnpm -C e2e e2e:full*` flows. The default `pnpm -C e2e e2e*` flows exclude `@fresh` via Cucumber config tags so they can be re-run against an already initialized instance.
Because of that, the `@fresh` install scenario only runs in the `pnpm -C e2e e2e:full*` flows. The default `pnpm -C e2e e2e*` flows exclude `@fresh` and `@preview` via Cucumber config tags so they can be re-run against an already initialized instance while keeping Builder Preview scenarios opt-in.

Reset all persisted E2E state:

Expand Down Expand Up @@ -174,7 +180,7 @@ open cucumber-report/report.html
1. Add step definitions under `features/step-definitions/<capability>/`
1. Reuse existing steps from `common/` and other definition files before writing new ones
1. Run with `pnpm -C e2e e2e -- --tags @your-tag` to verify
1. Run `pnpm -C e2e check` before committing
1. Run `vpr lint --fix --quiet` from the repository root and `pnpm -C e2e type-check` before committing

### Feature file conventions

Expand Down Expand Up @@ -278,29 +284,41 @@ When('I fill in the app name in the dialog', async function (this: DifyWorld) {

### Failure diagnostics

The `After` hook automatically captures on failure:
The `After` hook automatically captures diagnostics for failed, ambiguous, pending, undefined, or unknown scenarios:

- Full-page screenshot (PNG)
- Page HTML dump
- Console errors and page errors

Artifacts are saved to `cucumber-report/artifacts/` and attached to the HTML report. No extra code needed in step definitions.

## Reusing existing steps
Skipped preflight scenarios should attach the blocked-precondition reason to the skipped step and should not create screenshot or HTML artifacts.

Before writing a new step definition, inspect the existing step definition files first. Reuse a matching step when the wording and behavior already fit, and only add a new step when the scenario needs a genuinely new user action or assertion. Steps in `common/` are designed for broad reuse across all features.
### Seed resources and preflight checks

Or browse the step definition files directly:
Use `support/naming.ts` for generated test resource names. New app, Agent, dataset, file, or credential seeds should start with `E2E` so local and shared environments can identify disposable resources.

- `features/step-definitions/common/` — auth guards and navigation assertions shared by all features
- `features/step-definitions/<capability>/` — domain-specific steps scoped to a single feature area
Use `fixtures/test-materials/` for checked-in files that scenarios upload, preview, index, or retrieve. Keep these fixtures small and deterministic, and use `support/test-materials.ts` to resolve their absolute paths.

Use scoped feature support for scenarios that require optional external resources such as a model provider, plugin/tool credential, knowledge base seed, or fixed app. Prefer an explicit `Given` step that returns a skipped result with a clear blocked-precondition reason over hidden setup in hooks.

## Agent v2 scenarios
Treat preflight checks as read-only readiness checks. A preflight step may query the environment, record typed state on `DifyWorld`, attach a blocked-precondition reason, or return `skipped`; it must not create, repair, publish, reconfigure, or mutate shared seed resources. Treat the preflight suite as a readiness and drift report, not as a seed manager. Long-lived resources belong to the environment seed/setup process and need an explicit owner outside individual scenarios.

Agent v2 scenarios live under `features/agent-v2/` and use the `@agent-v2` capability tag.
Keep package-level support limited to broadly reusable primitives such as API clients, naming, fixture path resolution, and cleanup helpers. Feature-specific seed contracts and preflight checks belong under the owning feature's support folder.

The E2E web environment enables Agent v2 through `NEXT_PUBLIC_ENABLE_AGENT_V2=true` in `scripts/common.ts`, because `/roster` routes are guarded by that feature flag.
Use generated API contracts for Console/Web/Service API request, response, and payload shapes. Import the concrete type directly from `@dify/contracts/.../types.gen` when it exists, and do not hand-write duplicate response shapes or wrap generated types in local aliases just to preserve an older helper name. Keep local E2E types only for scenario state, fixture registries, helper input options, preflight resource state, and intentionally narrowed test view models that are not complete API responses.

Use `support/agent.ts` for Agent v2 API fixtures. It owns roster-shaped Agent IDs, configure/access route helpers, composer draft sync, build-draft helpers, publish, API access toggles, and Agent cleanup. Store created roster Agent IDs in `DifyWorld.createdAgentIds`; the shared `After` hook deletes them after each scenario.
Use typed cleanup fields on `DifyWorld` for resource types created by scenarios, and use `DifyWorld.registerCleanup(...)` when a scenario creates any resource type that is not covered by typed cleanup fields. Typed cleanup should remove child or referencing resources before their owners, such as Agent files before Agents and workflow apps before Agents they reference. Cleanup failures should be attached to the report instead of being swallowed silently. Cleanup callbacks run after typed cleanup queues, even when the scenario fails.

Keep Agent v2 step definitions under `features/step-definitions/agent-v2/`. Prefer API setup for prerequisite state, then use Playwright only for user-observable navigation, editing, and assertions.
Scenario-owned setup may create disposable apps, Agents, files, credentials, drafts, or access toggles when the scenario owns their lifecycle and cleanup. Do not use scenario setup to silently fix or complete a shared preseeded resource; if a fixed resource is missing or drifted, report it as blocked and route it to the seed owner.

Feature-specific seed contracts, resource readiness rules, tags, and scenario ownership can be documented in one scoped `AGENTS.md` at the feature root when a module becomes large enough to need it. Do not add deeper `AGENTS.md` files unless the nested module becomes independently owned.

## Reusing existing steps

Before writing a new step definition, inspect the existing step definition files first. Reuse a matching step when the wording and behavior already fit, and only add a new step when the scenario needs a genuinely new user action or assertion. Steps in `common/` are designed for broad reuse across all features.

Or browse the step definition files directly:

- `features/step-definitions/common/` — auth guards and navigation assertions shared by all features
- `features/step-definitions/<capability>/` — domain-specific steps scoped to a single feature area
6 changes: 5 additions & 1 deletion e2e/cucumber.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { IConfiguration } from '@cucumber/cucumber'

const hasCliTags = process.argv.some(arg => arg === '--tags' || arg.startsWith('--tags='))
const defaultTags = process.env.E2E_CUCUMBER_TAGS
|| (hasCliTags ? undefined : 'not @fresh and not @skip and not @preview')

const config = {
format: [
'progress-bar',
Expand All @@ -10,7 +14,7 @@ const config = {
import: ['./tsx-register.js', 'features/**/*.ts'],
parallel: 1,
paths: ['features/**/*.feature'],
tags: process.env.E2E_CUCUMBER_TAGS || 'not @fresh and not @skip',
...(defaultTags ? { tags: defaultTags } : {}),
timeout: 60_000,
} satisfies Partial<IConfiguration> & {
timeout: number
Expand Down
Loading
Loading