Commit ba6a73c
authored
feat(judge): ✨ replace self-attested goal completion with independent Judge subagent (#227)
* feat(goal): ✨ replace self-attestation goal_scored with independent Judge acceptance agent
Remove the `goal_scored` tool that allowed the main agent to
self-attest goal completion, replacing it with an `agent_judge`
built-in subagent that independently verifies goal attainment
against the project's current state.
Key changes:
- Add `SubagentProfile::Judge` with read-only file tools and
diagnostic-only shell (soft constraint via prompt)
- Add `JudgeReport` structured contract (passed, completeness_pct,
findings, summary) with safe fallback parsing
- Add `agent_judge` tool injection only for the main agent when
an unverified goal exists; runtime gate blocks subagent/parallel
recursion into Judge
- Add DB migration for `judge_passed`, `judge_completeness`,
`judge_findings`, `judge_summary`, `judge_evaluated_run_id`
columns with backfill for legacy `status='complete'` goals
- Replace continuation stop condition: `Complete && judge_passed`
instead of `goal_scored`-driven status flip
- Rewrite continuation prompt to instruct main agent to call
`agent_judge` and follow findings on rejection
- Add Judge prompt surface, templates, and output contract
- Update `active_goal.tpl.md` to reflect Judge acceptance flow
- Extend goal lifecycle tests for Judge pass/fail/legacy compat
* refactor(goal): ♻️ remove mark_complete and complete verdict
Remove the mark_complete pathway from goals as completion will be
handled through a different mechanism:
- Remove mark_complete method from GoalManager
- Remove "complete" from GoalEvaluateResult verdict type
- Remove mark_complete test cases (evidence validation, etc.)
- Update subagent surface comments to include judge
BREAKING CHANGE: GoalEvaluateResult.verdict no longer includes "complete"
* docs: 📝 update and reorder README feature list
Update the feature descriptions and reorder the bullet points in both
README.md and README_zh.md to better reflect the current product
capabilities and improve readability. Changes include:
- Reordering features to highlight persistent goal management, real-time
streaming, and extensibility earlier in the list
- Updating descriptions for several features to be more accurate
- Maintaining consistency between English and Chinese versions
- Keeping the overall structure while improving flow
These are documentation-only changes that do not affect functionality.
* refactor(goal): ♻️ extract resolveGoalStatusKey for testability
- Extract inline status key resolution into a pure exported function
so the complete→verified (judgePassed) branch can be unit-tested
without mounting the component
- Add unit tests covering all status mappings and judgePassed variants
- Add test for skipped verdict passthrough in goalEvaluate
* refactor(subagent): 🔧 increase builtin default max delegation depth to 5
Raise `BUILTIN_DEFAULT_MAX_DELEGATION_DEPTH` from 3 to 5 to match the
existing `GLOBAL_MAX_DELEGATION_DEPTH`, allowing built-in subagents
(explore/review) to be delegated to the same depth as custom profiles.
Update delegation validation tests to reflect the new depth limits.
* docs: 📝 remove obsolete design document
* docs(judge): 📝 add size-first verification strategy and delegation guidelines
* refactor(goal): ♻️ remove goal-level time_used_seconds in favor of run-level elapsed tracking
* feat(judge): ✨ redesign Judge evaluation for independence and completeness
* fix(subagent): 🐛 make task field optional and fix UTF-8 safe truncation
- Downgrade Judge prompt versions from 2 to 1 (likely a revert of unintended bump)
- Change `task` field from required to optional in Judge tool schema, with updated description clarifying it is an optional note
- Replace byte-based truncation with character-safe truncation to avoid panicking on multi-byte UTF-8 in process compliance summary
- Simplify Judge request validation to only check input validity, discarding the parsed result used only for backward compatibility
- Skip abandoned task boards when building summary to focus on relevant goal state
* chore(deps): 🔧 align tiycore to 0.2.10-rc.2 and adopt Usage::context_size()
Cherry-pick the master commit (a03d9ba) that bumps tiycore from 0.2.9
to 0.2.10-rc.2 and unifies context_size semantics across
RunUsageDto / frontend badge / auto-compression, removing the old
initial_context_calibration heuristic path. No file conflict with
the Judge work in this branch — the 25 files touched here do not
overlap with the 6 Judge files resolved in the previous merge.
* refactor(goal): ♻️ centralize status transitions to explicit commands and Judge verdicts
* fix(agent): 🐛 fix timestamp slicing panic and add has_process_requirements tests
Replace byte-index slicing with char-aware truncation to prevent
panics on multi-byte UTF-8 boundaries in timestamp formatting.
Add unit tests for `has_process_requirements()` covering English
and CJK keywords, substring match behaviour, edge cases, and
case-insensitive matching.
* feat(compression): ✨ reserve 20% context window for auto-compression trigger
Backend: replace fixed 16,384 token reserve with 20% of model context
window (min floor 16,384). Small-window models keep the floor; GPT-4o
class windows reserve ~25.6K, Claude-class ~40K, 1M-window ~200K.
Frontend: add dashed threshold marker at 80% position in the thread
header context pill so users can see when auto-compression will fire.
* fix(run): 🐛 record elapsed running time when interrupting active runs
* test: cover Judge summary builders and mapRunSummaryToContextUsage fallback
Add four integration tests in agent_session_execution.rs for the
Judge-prompt context builders (build_task_board_summary,
build_process_compliance_summary) covering absent boards, active/abandoned
board filtering, review-only helper filtering, status symbol mapping, and
200-char input truncation.
Add six unit tests in runtime-thread-surface-state.test.ts for
mapRunSummaryToContextUsage covering null input, explicit contextSize
precedence, fallback to per-bucket sum, and full-field passthrough.
Addresses review feedback from PR #227 (round 4):
- #1 New DB-backed Judge summary functions lack tests
- #4/#8 contextSize parsing/fallback logic lack unit tests1 parent f05858c commit ba6a73c
16 files changed
Lines changed: 924 additions & 235 deletions
File tree
- src-tauri
- src
- core
- prompt/templates
- subagent
- subagent
- model
- persistence/repo
- tests
- src/modules/workbench-shell/ui
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
| |||
233 | 240 | | |
234 | 241 | | |
235 | 242 | | |
236 | | - | |
| 243 | + | |
237 | 244 | | |
238 | 245 | | |
239 | 246 | | |
| |||
244 | 251 | | |
245 | 252 | | |
246 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
247 | 267 | | |
248 | 268 | | |
249 | 269 | | |
| |||
911 | 931 | | |
912 | 932 | | |
913 | 933 | | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
914 | 977 | | |
915 | 978 | | |
916 | 979 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | 258 | | |
287 | 259 | | |
288 | 260 | | |
| |||
307 | 279 | | |
308 | 280 | | |
309 | 281 | | |
310 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
311 | 287 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | 288 | | |
332 | 289 | | |
333 | 290 | | |
| |||
342 | 299 | | |
343 | 300 | | |
344 | 301 | | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
352 | 308 | | |
353 | 309 | | |
354 | 310 | | |
| |||
359 | 315 | | |
360 | 316 | | |
361 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
362 | 324 | | |
363 | 325 | | |
364 | 326 | | |
| |||
370 | 332 | | |
371 | 333 | | |
372 | 334 | | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
395 | 343 | | |
396 | 344 | | |
397 | 345 | | |
398 | 346 | | |
399 | 347 | | |
400 | | - | |
401 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
402 | 352 | | |
403 | 353 | | |
404 | 354 | | |
| |||
407 | 357 | | |
408 | 358 | | |
409 | 359 | | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | 360 | | |
436 | 361 | | |
437 | 362 | | |
| |||
613 | 538 | | |
614 | 539 | | |
615 | 540 | | |
616 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
617 | 550 | | |
618 | 551 | | |
619 | 552 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
0 commit comments