feat(adapter): pointer file default_task_id and actionable auto-fallback toast#23
Merged
Conversation
albertgwo
commented
May 9, 2026
albertgwo
commented
May 9, 2026
albertgwo
commented
May 9, 2026
albertgwo
commented
May 9, 2026
albertgwo
commented
May 9, 2026
albertgwo
commented
May 9, 2026
Address PR #23 review feedback. - session-bootstrap.sh: capture exit code and stderr from `agent-ledger pointer show --json` separately. A malformed `.agent-ledger.toml` no longer falls through to a misleading not_in_git_repo / git_no_head hint; the new AGENT_LEDGER_TASK_AUTO_REASON=pointer_unreadable surfaces the kernel error and points the operator at the broken file. - session-bootstrap.sh: when neither python3 nor node is on PATH, emit a clear stderr warning and AUTO_REASON=pointer_parser_unavailable rather than silently ignoring a declared default_task_id. - internal/cli/init.go: move the `--default-task-id requires --write-pointer` usage check above storage.EnsureLayout so a misuse no longer leaves a half-initialized ledger directory on disk. - internal/cli/pointer.go: reword the pointerShowReport doc comment so future consumers do not infer existence from field absence; the authoritative signal is `present`. - adapters/shared/auto-fallback-toast.js (new): node-importable mirror of the TS extension's AUTO_REASON_HINTS map and buildAutoFallbackToast helper, used by the new adapter test suite. - adapters/tests/auto-fallback-toast.test.mjs (new): covers known reason, unknown reason, null reason, null taskId, and exhaustive coverage of every reason token the bootstrap can emit. - adapters/tests/run.sh: byte-level parity check between the inline TS AUTO_REASON_HINTS and the shared JS mirror so drift is caught statically; new pointer_unreadable regression test using AGENT_LEDGER_STUB_POINTER_FAIL. - internal/cli/init_test.go (new): tests for the side-effect-free usage validation, default_task_id carry-forward on rerun without --default-task-id, and explicit override. - CHANGELOG: document the new auto-reason tokens and fixes.
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.
Purpose
Give non-git, ambient multi-agent projects a one-line way to declare a shared task id, and make the auto-fallback toast tell the operator the cheapest fix. Two pi sessions in the same scratch directory now attribute to one task without per-session env wiring.
Summary of changes
internal/configadds an optionaldefault_task_idfield to.agent-ledger.toml.agent-ledger pointer show [--json]command atinternal/cli/pointer.go, with the existinginitlearning a--default-task-idflag that carries forward across reruns.internal/doctorsurfacesdefault_task_idandhas_default_taskin the pointer check details.adapters/shared/session-bootstrap.shinserts a pointer step (source=pointer) between detached HEAD and the auto fallback, and emitsAGENT_LEDGER_TASK_AUTO_REASON(not_in_git_repo,git_no_head,pointer_lacks_default) when the auto path fires.adapters/pi/agent-ledger.tsaddsbuildAutoFallbackToastthat expands the reason token into actionable guidance.adapters/shared/marker.{sh,js}addspointerto the harness-derived source set so reviewers can group claims by source.docs/adapters.mdandSPEC.md §8.2describe the new source and the example pointer; CHANGELOG entry in Unreleased.Changes to review
session-bootstrap.sh: pointer is step 6, between detached HEAD and the auto fallback. Confirm this priority matches the intent (explicit env still wins, harness-derived git signals still win).docs/adapters.md. Decide whether to track upward search as a follow-up.init --write-pointercarries an existingdefault_task_idforward when--default-task-idis not supplied, so reruns do not silently erase the value (internal/cli/init.go).buildAutoFallbackToastinadapters/pi/agent-ledger.ts: confirm the reason-to-hint map covers every token the bootstrap can emit and that unknown tokens degrade to a(reason=...)form.adapters/tests/run.shrely on a newAGENT_LEDGER_STUB_POINTER_JSONenv override on the kernel stub. Confirm the stub additions stay scoped to the new cases and do not leak into earlier tests.