feat: local 任務源去 am 化 — inbox 預設路徑與 ticket 契約歸屬 (CH-009)#10
Merged
Conversation
…ct (CH-009) Default the local source inbox to <GlobalHome>/tickets instead of the hardcoded ~/.am/tickets, so it follows GOGENTS_HOME isolation and no longer points at a third-party tool's directory. Promote the ticket schema to gogents' own contract (R11), with am demoted to one of several producers. - internal/source/local.go: resolve the default inbox via foundation.GlobalHome(); TaskContent.Author is now "local" rather than "am". - Producer-neutral claim rule: only status == queued is claimed; every other value leaves dispatch timing to the producer. - docs: R11 gains a field-ownership column; R01/R02/D01/D07, requirement.md, unit-tests.md, design-plan.md, README and AGENTS converged on the new default. - Add TestExpandTicketDir (D07-05a) covering default, explicit and ~/ paths. am is unaffected: it always writes an absolute source.path, so it never hits the fallback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
local任務源原本以 am 為隱含前提:預設 inbox 寫死~/.am/tickets、ticket schema 記為「欄位由 am 定義」。本 PR 把預設落點與 schema 契約收回 gogents 自己——預設 inbox 改為<全域家目錄根>/tickets(隨GOGENTS_HOME隔離),ticket 契約升格為 gogents 的本機任務源契約(R11 為真相源),am 降為其中一種 producer。變更單:
docs/changes/change-local-ticket-contract.md(CH-009)。改動內容
internal/source/local.go:inbox 預設值改由foundation.GlobalHome()推導成<GlobalHome>/tickets;顯式source.path行為不變(僅展開開頭~/)。internal/source/local.go:TaskContent.Author由固定字串am改為local(標示來源型別,不再指名 producer);認領規則的註解改為 producer 中立表述。internal/foundation/config.go:source.path預設值註解同步。id/worker/goal/context/verify屬 producer、result/updated_at屬 gogents、status共同;「其他任何欄位」不讀不寫、回寫時原樣保留。TestExpandTicketDir(D07-05a):覆蓋預設值、顯式路徑、~/展開三條解析路徑。影響範圍與風險
runtime.yaml的source.path(CH-006 §3.3 盤點確認),走不到本次改動的 fallback。本 PR 未動 am。source.path的既有 runtime 行為不變——只有「省略source.path且倚賴~/.am/tickets預設值」的 runtime 需改為顯式指定該路徑。status/result/updated_at的寫入、原子寫入、保留未知欄位皆同)。github_issue來源、task store、狀態機、執行流程皆未觸碰。備註 / 待辦
本 PR 有兩個我自行判斷的決策,請一併審核:
source.path打錯字時 daemon 靜默空轉,而非啟動當下就報錯。已寫進 R11/D07/CH-009 §3.1。processing_started表述:原文件寫「(可選)標記進入執行」,但程式一直是 no-op;本次把文件改成對齊程式的 no-op。README/AGENTS/R01–R12 的整體定位重寫(拔除「am 的執行面」定位)、LICENSE、release pipeline 留給 CH-010。
驗收方式(請你手動驗證)
1. 預設 inbox 隨
GOGENTS_HOME走go test ./internal/source/ -run TestExpandTicketDir -v預期:三個 subtest 全 PASS——
""→$GOGENTS_HOME/tickets、/srv/tickets原樣、~/inbox→$HOME/inbox。2. 端到端:省略
source.path時 daemon 讀新預設路徑編輯
/tmp/ch009-demo/.gogents/runtime.yaml,把source改成type: local、filter.label: backend,並且不要寫path;project.repo.url填一個你有權限的 repo。接著放一張 ticket:預期:daemon 通過 preflight 並認領
t-1(不再抱怨~/.am/tickets不存在)。任務終態後檢查$GOGENTS_HOME/tickets/t-1.yaml:status為done/failed、有result、updated_at已更新,而mission/depends_on原樣保留。3. inbox 不存在時拒啟且不代建
預期:啟動即失敗,錯誤訊息指出 ticket inbox 不存在/不可讀;且
$GOGENTS_HOME/tickets不會被建出來(ls "$GOGENTS_HOME"看不到tickets)。4. 回歸
預期:全數通過。