ソースを参照

docs: plan plugin token compatibility fixes

Problem: remaining negations and malformed numeric tokens can cause side effects, integral floats are not canonical, fallback usage can be lost, date-time semantics are narrowed, and new dataclass fields shift positional callers.

Risk: rejection must avoid LLM fallback for substantive input while canonicalization and field reordering preserve existing schemas and public construction behavior.
zhenyu.hu 2 週間 前
コミット
79437c59e5

+ 46 - 0
docs/plans/todo-47.2-plugin-token-and-compatibility-boundaries.md

@@ -0,0 +1,46 @@
+# Todo 47.2 Plugin Token and Compatibility Boundaries Plan
+
+**Status:** in_progress
+
+## Goal
+
+Close the remaining quality-gate findings without expanding plugin behavior or generic orchestration scope.
+
+## Scope
+
+- Reject `不静音`, `不用静音`, `无需静音`, `no mute`, and equivalent negations as substantive invalid input with no LLM fallback or port call.
+- Reject decimal/grouped numeric phrases such as `40.5`, `10.5`, and `1,000` without truncating them into valid integers.
+- Canonicalize JSON Schema integral floats (`2.0`, `40.0`) to Python `int` for volume, search, and schedule numeric fields before ports/cache keys.
+- Preserve `used_fallback=True` when a post-fallback normalizer fails.
+- Use the standard `jsonschema` RFC3339 `date-time` checker; keep only the custom `iana-timezone` checker.
+- Move newly added dataclass fields to the end so existing positional `EventDefinition` and `ToolDefinition` construction keeps its historical meaning.
+
+## Files
+
+- Modify: `src/agent_lab/application/events/models.py`
+- Modify: `src/agent_lab/application/events/kernel.py`
+- Modify: `src/agent_lab/application/events/registry.py`
+- Modify: `src/agent_lab/application/events/builtin_plugins.py`
+- Modify: `src/agent_lab/application/tools.py`
+- Modify: `tests/test_event_kernel.py`
+- Modify: `tests/test_builtin_event_plugins.py`
+
+## Requirement Execution Loop
+
+### Plan
+
+1. Add RED tests for all named negation and malformed numeric phrases; assert zero fallback and zero port calls.
+2. Add RED canonical-number tests proving ports/cache treat integral floats as integers and equivalent values share cache keys.
+3. Add RED post-fallback normalizer failure and positional-constructor compatibility tests.
+4. Add RED lowercase `t`/`z` RFC3339 acceptance while retaining invalid-calendar rejection.
+5. Implement the smallest parser/normalizer/kernel/dataclass changes and run final bounded reviews.
+
+### Observe / Update
+
+Close Todo 47 only when no Critical/Important findings remain and all external side effects are protected by canonical validated arguments.
+
+## Verification
+
+- `UV_CACHE_DIR=.uv-cache uv run pytest tests/test_event_kernel.py tests/test_builtin_event_plugins.py -q`
+- `UV_CACHE_DIR=.uv-cache uv run pytest`
+- `git diff --check`

+ 1 - 0
docs/plans/todos.md

@@ -86,6 +86,7 @@
 | 46.1 | done | `docs/plans/todo-46.1-mode-parity-and-duplicate-call-safety.md` | Reject repeated provider call IDs before side effects, align direct multi-call concurrency with dual mode, and enforce the same event budget in both modes. | Duplicate IDs are rejected before side effects; direct batches overlap with stable order; dual/direct budgets are symmetric; final gates pass. |
 | 47 | in_progress | `docs/plans/todo-47-built-in-event-plugins.md` | Add terminate-session, device-volume, schedule, and web-search as built-in plugins on the generic event kernel. | Plugin contract tests cover valid, ambiguous, invalid, idempotent, and failure results for all four events. |
 | 47.1 | in_progress | `docs/plans/todo-47.1-plugin-normalization-and-validation.md` | Share plugin normalization across invocation modes and harden negation, numeric, date/timezone, query, and adapter idempotency boundaries. | Direct/dual canonical results match; negated/oversized volume never executes; invalid calendar/timezone and blank query are rejected; short ID collisions cannot return stale results. |
+| 47.2 | in_progress | `docs/plans/todo-47.2-plugin-token-and-compatibility-boundaries.md` | Reject remaining negated/non-integer volume tokens, canonicalize integral JSON numbers, preserve fallback state, use standard date-time semantics, and restore positional dataclass compatibility. | No negated/decimal/grouped volume side effects; `2.0` becomes canonical `2`; fallback errors retain usage; lowercase RFC3339 works; old positional definitions remain valid. |
 | 48 | pending | `docs/plans/todo-48-parallel-event-batches.md` | Execute multiple flat events with bounded parallelism, failure isolation, aggregation, and a terminal barrier. | Runtime tests prove independent concurrency, stable result order, isolated failures, and termination after sibling completion or timeout. |
 | 49 | pending | `docs/plans/todo-49-tool-mode-ui-session-restore.md` | Add UI mode selection, workspace/session restoration, and clear EventAgent applicability feedback. | Static/WebSocket tests prove requests, snapshots, loaded sessions, and audit context preserve the selected mode. |
 | 50 | pending | `docs/plans/todo-50-comparable-model-tool-metrics.md` | Record mode-aware model/tool spans and include EventAgent usage so both architectures can be compared fairly. | Persistence/API tests report agent, call kind, tokens, TTFT, tool latency, fallback usage, and total turn wall time without double counting. |