Skip to content

docs(agents): add task-state-invariants skill - #1414

Draft
Linux2010 wants to merge 2 commits into
a2aproject:mainfrom
Linux2010:docs/agents-task-state-skill
Draft

Linux2010 wants to merge 2 commits into
a2aproject:mainfrom
Linux2010:docs/agents-task-state-skill

Conversation

@Linux2010

Copy link
Copy Markdown
Contributor

Description

Adds a second agent skill to the repo's rule layer, plus the router line that makes it loadable. Proposed and discussed in #1413.

AGENTS.md routes code style to docs/ai/coding_conventions.md, the pre-done gate to docs/ai/mandatory_checks.md, and mistakes to mistake-reflection — but nothing states which surfaces a task-state write must reach. That missing link keeps producing the same defect class: a value that is correct on one surface and missing or stale on another.

This PR adds .agents/skills/task-state-invariants/SKILL.md, in the same shape as mistake-reflection (trigger list → procedure → anti-patterns):

  • the invariant set, each claim anchored to current main: terminal states require status.timestamp (utils/constants.py:35 → database_task_store.py:152-157); stamp the event before CopyFrom, not the copy after (task_manager.py:285); CopyFrom inherits the previous timestamp, so explicit transitions such as the cancel path (active_task.py:971-973) must restamp; push delivery is best-effort (active_task.py:409); zero events means an unbounded wait (default_request_handler_v2.py:518-520 → active_task.py:1115-1117); store and stream must agree; v0.3 compat has two independent mappers (compat/v0_3/proto_utils.py vs conversions.py); continuation identity is inferred per spec §3.4.3;
  • a sibling-surface checklist to run before declaring such a change done;
  • a test map naming the existing file per surface, so coverage lands where the surface is;
  • the evidence a PR in this area should carry, consistent with docs/ai/evidence_rules.md.

Also adds one numbered item to AGENTS.md → "Mandatory workflow". Without it the skill is unreachable: the rule layer scan shows AGENTS.md is the only file in the repo that links into .agents/skills/.

Scope is documentation only — no runtime code, no public API, no behavior change. If maintainers would rather the rule text live in docs/ai/ with a thin skill pointer, or want the AGENTS.md line dropped, say so and I will reshape it.

  • Follow the CONTRIBUTING Guide.
  • Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
  • Ensure the tests and linter pass (Run bash scripts/format.sh from the repository root to format)
  • Appropriate docs were updated (this PR is the documentation)

Fixes #1413 🦕

Validation

  • Claim: the mandatory check sequence passes on this branch, and the skill loads under the same frontmatter contract as mistake-reflection.
  • Exact head: 2ab36de
  • BEFORE: .agents/skills/ contained one skill (mistake-reflection) and AGENTS.md had one route into it; nothing documented sibling-surface propagation. AFTER: two skills, two routes, no code change (git diff --name-only lists only AGENTS.md and the new SKILL.md).
  • ./scripts/lint.sh: SUCCESS — "All linting and formatting tasks complete", ty reports only the 3 pre-existing unused-ignore-comment diagnostics that are present on clean main as well.
  • uv run pytest: 2520 passed, 207 skipped, 4 xfailed, 1 xpassed. The 4 tests/integration/cross_version errors are environmental, not caused here: stashing this branch's changes and re-running on clean main reproduces the identical 4 errors (AssertionError: Server 0.3 HTTP failed to start — the sandbox cannot bind the subprocess server).
  • Every file:line in the skill was re-read from current main at this head rather than copied from older notes; the anchors that changed since I first drafted them (a duplicated TERMINAL_TASK_STATES that has since been centralized in utils/constants.py:35) were corrected before committing.

Prepared with AI assistance (WorkBuddy); reviewed and verified by Linux2010

Most task-lifecycle defects in this SDK are not wrong values: they are a
correct value that reached one surface and not the others (persisted store,
streaming subscribers, push notifications, the cluster task_events table,
and the two separate v0.3 compat mappers). The existing rule layer routes
mistakes to mistake-reflection and code style to docs/ai, but nothing tells
a change agent which surfaces a status write must reach, so the same class
keeps recurring: a2aproject#1276 (status.timestamp mapped for JSON-RPC/REST compat but
not gRPC), a2aproject#1188 (handler resumes from a stale snapshot), a2aproject#1206/a2aproject#1411
(contextId inference disagrees between events and the stored task), and the
review findings on a2aproject#1346 (stamping the copy instead of the event, and missing
the CANCELED paths).

Adds .agents/skills/task-state-invariants/SKILL.md with the invariant set
(each claim anchored to current main), the sibling-surface checklist, the
matching test files per surface, and the evidence expected in a PR, plus a
one-line router pointer in AGENTS.md so agents actually load it.

Signed-off-by: andy <linux2011@qq.com>
a2aproject#1403 is an error-handling divergence on the v0.3 REST surface rather than a
field-mapping one, so describe it as the second shape the same gRPC-vs-
JSON-RPC/REST split produces instead of implying it dropped a field.

Signed-off-by: andy <linux2011@qq.com>

This branch has not been deployed

No deployments
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.

[Feat]: Add a task-state-invariants agent skill for sibling-surface propagation

1 participant