Commit Graph

149 Commits

Author SHA1 Message Date
root
fc114def7a docs(s17): fix incorrect s16 comparison in changes-from-s16 table
The table had several inaccurate entries for the s16 column. s16
already had a WORK→IDLE→SHUTDOWN state machine, handled
shutdown_request during IDLE, and used consume_lead_inbox for
protocol routing and history injection — but the table described
s16 as having none of these.

This updates the table so the s16 column reflects what s16
actually does, verified against s16_team_protocols/code.py.
All three README languages are synchronized.

Closes #480
2026-07-28 21:29:53 +08:00
root
581241cdc7 fix(s03,s04,s20): remove dead safe_path, sync READMEs
- Delete safe_path entirely (following PR #483 approach) — no dead code
- Update all 3 READMEs per module to reflect read_file in Gate 2
- s04: also update permission_hook snippet in READMEs
- s20: remove safe_path (already replaced with inline resolution)

Closes #482
2026-07-28 20:24:01 +08:00
root
97b8541b36 fix(s04,s20): resolve Gate2 safe_path conflict same as s03
s04_hooks: permission_hook checks path + asks user, but safe_path
still raised hard ValueError — user approval was ineffective, same
root cause as s03 (#482).

s20_comprehensive: permission_hook used safe_path directly inside
try/except, silently denying all writes outside workspace without
ever asking the user.  Now uses is_relative_to check + user prompt.

Both files also add read_file to the permission coverage.

s05-s08 intentionally NOT changed: their permission_hook does not
check paths at all — safe_path is their only path-safety defense.
2026-07-28 20:23:58 +08:00
Viper
4d8d420e41 fix(s03): let Gate 2 own the workspace boundary instead of safe_path
safe_path hard-raised on out-of-workspace paths while Gate 2 asked about the same condition, so approving an out-of-workspace write never took effect. Make the permission pipeline the sole boundary authority: drop safe_path, resolve paths directly in the file tools, and extend the Gate 2 rule to read_file. Sync all three READMEs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 20:23:56 +08:00
Yang Haoran
a9cafe953a Merge pull request #433 from Bill-Billion/codex/update-env-models
[codex] Update provider model examples
2026-06-27 03:36:34 +08:00
Haoran
9d9453cff0 Update provider model examples 2026-06-27 03:32:20 +08:00
Yang Haoran
4545a380e6 Merge pull request #362 from Panda-eyes123/fix
fix: show error messages when API exceptions occur in s12-s20
2026-06-27 01:55:39 +08:00
Yang Haoran
85f6e511bb Merge pull request #361 from YonganZhang/docs/canonical-kode-repo-links
docs: use canonical Kode repository links
2026-06-27 01:29:36 +08:00
Yang Haoran
5c3328101f Merge pull request #286 from 123456wda/fix/s09-s10-s11-missing-dev-null-check
fix: add missing "> /dev/" dangerous command check in s09/s10/s11
2026-06-27 01:28:25 +08:00
Yang Haoran
939446d412 Merge pull request #245 from bansalkanav/main
fix sequence notation by adding missing `>` after active step markers
2026-06-27 01:27:06 +08:00
Yang Haoran
5cde7c548f Merge pull request #432 from Bill-Billion/add_contributing
Add CONTRIBUTING with contribution scope and review policy
2026-06-27 01:25:31 +08:00
Haoran
c32ce1af94 Add CONTRIBUTING with scope and review policy
State the contribution rules for this teaching repository: tie each PR to an
issue, keep teaching code minimal, keep the three language READMEs in sync,
target current chapter files, and disclose AI assistance. Note that bulk PRs
generated by an agent across many repositories may be closed without detailed
review.
2026-06-27 01:17:52 +08:00
Yang Haoran
dd092054ed Merge pull request #431 from Bill-Billion/fix_374_idle_poll
s17: remove redundant idle_poll agent_name parameter and sync READMEs
2026-06-27 01:03:50 +08:00
Haoran
f366a86239 Sync s17 READMEs with the idle_poll signature change
The code change dropped the redundant agent_name parameter, but the
trilingual README snippets still showed the old four-arg signature, the
double-passed call site, and agent_name inside the function body
(read_inbox and claim_task). Update all three language code blocks to
the three-arg form and bump the translation-sync markers so the docs
match the code.
2026-06-27 00:54:34 +08:00
chaochaoweb3
cbb3bd8c44 Remove duplicate idle poll name parameter 2026-06-27 00:54:34 +08:00
Yang Haoran
ab2cf01b2b Merge pull request #429 from Bill-Billion/feat/s15-poller-background-results
Cover completed background tasks in the Lead's inbox poller, and mark when teammates finish (#46)
2026-06-26 02:42:39 +08:00
Haoran
647a8dced2 Cover completed background tasks in the Lead's inbox poller, and mark when teammates finish (#46)
The inbox poller added in #291 wakes the Lead on teammate inbox messages, but a
completed background task still strands its result: nothing wakes the Lead for it,
and collect_background_results() runs only inside the tool-use branch, so a
plain-text turn never picks it up. There is also no signal once every teammate has
finished.

Extend the same poller instead of adding a second path. has_pending_background()
reports, without consuming, whether any background task has completed. The poller
now wakes on unread inbox messages or a completed background task, and the wake
handler drains both the inbox and collect_background_results() before running the
turn, so background results become new turns without user input, the same way
teammate results already do. When the last teammate finishes and its output has
been drained, a single "[all teammates done]" marker is printed.
2026-06-26 02:28:09 +08:00
Yang Haoran
17e2e12495 Merge pull request #428 from Bill-Billion/feat/issue-291-s15-inbox-poller
feat(s15): event-driven inbox poller so the Lead doesn't strand teammate results (#291)
2026-06-25 23:35:01 +08:00
Haoran
464a615b38 Lead loses teammate results when a turn ends without a tool call (#291)
After the Lead spawns teammate agents, if the current round terminates with
plain text (stop_reason != tool_use), agent_loop returns and the REPL falls
back to a blocking input(). Teammates run as daemon threads and finish later,
so the results they send to the Lead's inbox stay unconsumed until the user
submits their next input.

The cause is that result delivery is bound to the turn loop, whose lifetime
ends when the model stops calling tools, while a teammate completes on its own
clock. Blocking a teammate is harmless because it runs as a background thread;
the problem is specific to the Lead, which owns the user prompt.

The fix follows real Claude Code (useInboxPoller, described in the appendix):
decouple input() from turn execution. MessageBus.peek(agent) reports whether
the inbox has unread messages without consuming them. In __main__, input()
moves to a dedicated daemon thread and an inbox poller thread peeks the Lead's
inbox every second; both push to one shared event queue. The main thread runs
one turn per event, woken by either user input or an incoming teammate message,
so teammate results become new turns without waiting for the user. Repeated
inbox wakeups are idempotent: an empty read is skipped when a prior read_inbox
already drained the messages. Only the Lead's main loop changes; the teammates'
idle loops are untouched.
2026-06-25 23:26:42 +08:00
gui-yue
2a73474fb0 Merge pull request #375 from Gui-Yue/fix-s03-permission-example
docs: fix s03 permission gate example
2026-06-22 16:14:34 +08:00
gui-yue
4a329c9583 docs: fix s03 permission gate example 2026-06-22 16:10:06 +08:00
gui-yue
ef3e88eead Merge pull request #364 from costajohnt/refactor/reactive-compact-summarize-old-history
refactor: summarize only trimmed history in reactive_compact
2026-06-22 15:54:24 +08:00
costajohnt
90a044883f docs: align snip_compact README guards with code
Match the snip_compact teaching snippet (en/zh/ja) to code.py: add the
`head_end > 0` head guard and the `tail_start > 0 and tail_start <
len(messages)` tail bounds check before indexing messages, mirroring the
reactive_compact alignment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UJumwVeBXSGYh8nSzoVTF
2026-06-21 16:52:41 -07:00
costajohnt
7659f28976 docs: align reactive_compact README guard with code
The reactive_compact README snippets (en/zh/ja) used a shortened tail
boundary check, while code.py guards with `tail_start > 0 and tail_start
< len(messages)` before reading messages[tail_start]. Match the snippets
to the actual code so the teaching example stays consistent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UJumwVeBXSGYh8nSzoVTF
2026-06-21 16:47:09 -07:00
gui-yue
58ded12b98 Merge pull request #336 from clysir/fix-s09-subagent-arg
Fix s09 subagent tool argument mismatch
2026-06-21 22:55:32 +08:00
gui-yue
8daed25878 Fix s08 subagent tool argument mismatch 2026-06-21 22:32:41 +08:00
John Costa
49b3822247 refactor: summarize only trimmed history in reactive_compact
reactive_compact summarized the full message history before slicing off
the recent tail, so the kept tail was summarized and then re-attached
verbatim, and the emergency prompt-too-long path re-summarized the whole
oversized context. Move the summarize_history call below the tail
computation (including the tool_use/tool_result pair adjustment) and
summarize only messages[:tail_start], so the summary covers older history
while the recent tail stays verbatim.

Applied to the duplicated function in s08, s09, and s20, with the s08
README snippets (en/zh/ja) updated to match. Adds tests covering the
normal path and the case where a tool pair straddles the tail boundary.

Fixes #350
2026-06-15 21:55:21 -07:00
Panda-eyes123
4e594bb84a 修复错误返回时SDK对象和dict冲突 2026-06-14 21:54:22 +08:00
Yongan Zhang
65b1751dca docs: use canonical Kode repository links 2026-06-14 05:47:48 +08:00
gui-yue
20e7cbb72c Merge pull request #326 from wangle201210/fix/snip_compact
Fix compaction splitting tool-use/result pairs
2026-06-07 12:39:59 +08:00
gui-yue
99a1e52b36 fix: harden compaction pair handling 2026-06-07 12:35:08 +08:00
wanna
7891c25c12 fix: keep tool-use/result pairs intact during compaction
Preserve assistant tool_use / user tool_result adjacency when compaction trims message history.

Fixes #325.

Squashed original PR commits:

- Fix compaction breaking tool-use/result pairs

- Simplify compaction boundary fix
2026-06-07 12:35:00 +08:00
gui-yue
3d018a0d48 Merge pull request #347 from Gui-Yue/fix-s09-system-build-once
fix: build s09 memory system prompt once per request
2026-06-04 10:22:54 +08:00
gui-yue
8aa8adb346 fix: build s09 memory system prompt once per request 2026-06-04 00:09:09 +08:00
gui-yue
ec9ea874e6 Merge pull request #342 from Bill-Billion/codex/fix-todo-write-string-input
fix: handle todo_write string inputs
2026-06-03 23:33:36 +08:00
Haoran
ee9a747e09 fix: handle todo_write string inputs for issue 340
Co-authored-by: gui-yue <yuemeng.gui@gmail.com>
2026-06-03 23:24:34 +08:00
gui-yue
7c385819cd Merge pull request #346 from Gui-Yue/document-read-file-compact-tradeoff
Document read_file compact trade-off
2026-06-03 22:54:39 +08:00
gui-yue
ae94cda0ed Document read_file compact trade-off 2026-06-03 22:40:37 +08:00
gui-yue
91682fa7fc Merge pull request #339 from hardness1020/fix/memory-subsystems-arrow-direction
fix(s09_memory): point read/write arrow at memory files box
2026-06-02 23:47:37 +08:00
hardness1020
aef9e67167 fix(s09_memory): point read/write arrow at memory files box
Make the Storage to Memory Files arrow a straight vertical segment
ending at the box edge, instead of curving onto the dashed border.
Applies to the en, ja, and zh (default) diagram variants.
2026-06-01 17:49:44 -07:00
clysir
9f3fcf1afd Fix s09 subagent tool argument mismatch 2026-06-01 13:25:39 +08:00
Yang Haoran
595a52a17f Merge pull request #335 from Gui-Yue/sync-generated-course-content
Sync generated course content
2026-05-31 22:22:37 +08:00
gui-yue
abe09a9ccb Sync generated course content 2026-05-31 17:27:29 +08:00
gui-yue
4b87a07099 Merge pull request #334 from Gui-Yue/fix-skill-frontmatter-yaml
Fix skill frontmatter parsing
2026-05-31 17:20:05 +08:00
gui-yue
0100b3dc32 Fix skill frontmatter parsing 2026-05-31 16:54:14 +08:00
gui-yue
6c5bf580f8 Merge pull request #332 from Gui-Yue/pin-github-actions-shas
Pin GitHub Actions to SHAs
2026-05-31 16:30:22 +08:00
gui-yue
33ecaaf351 Pin GitHub Actions to SHAs 2026-05-31 16:27:56 +08:00
gui-yue
328af249dc Merge pull request #330 from Leiber-CivilComEngineer/fix-400-error-in-s13-background-tasks
fix 400 error in s13_background_tasks
2026-05-31 15:57:15 +08:00
Leiber Lyu
3fe4b128b5 Fix a bug where tool_result messages must appear before text in user messages 2026-05-31 14:29:41 +10:00
gui-yue
5c955480ee Merge pull request #329 from hardness1020/docs/s07-three-level-disclosure
docs(s07_skill_loading): note SKILL.md can guide later resource access via file/bash tools
2026-05-31 09:40:28 +08:00