Inject target and agent id; delete ENV reads in library code (absorbs #577) #633
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#633
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
User requested during the shell-call/ENV audit in session 16bf37b3-8cff-4121-896c-4a5fc61f2e9e. The user believed OS_SDLC_TARGET was already removed. #577 (open, filed 2026-09-14) already targets the OS_SDLC_TARGET fallback specifically; this ticket absorbs #577's remaining scope, adds the CC_OS_AGENT_ID and Dir.pwd fallback sites the audit found, and states the decided replacement design: target comes from the persisted implementation record (
implementation.target), not ENV; the agent id is passed as a parameter by the calling hook or skill, not read from ENV.Observed
#577 (open) already lists a near-identical OS_SDLC_TARGET fallback set from a 2026-09-14 grep, at slightly different line numbers (target_flag.rb:7, lint_worklist_target.rb:17, lint_worklist_report.rb:56,59, plus project_targets.rb error text, two SKILL.md mentions, and test_helper.rb/gate_commands_test.rb env setup). The files have since moved under lib/os_sdlc/cli/ and lib/os_sdlc/lint/ and the line numbers shifted, but the underlying fallback is still present. #577 requests an ADR superseding the ADR-0088 env-fallback clause; this ticket keeps that requirement and adds the CC_OS_AGENT_ID and Dir.pwd cwd-fallback sites this audit found, which #577 does not cover.
Reproduce
Expected
One prose sentence: no library code reads OS_SDLC_TARGET or CC_OS_AGENT_ID from ENV; target comes from
implementation.targeton the persisted implementation record, and the agent id is passed as an explicit parameter from the caller (hook or skill) into os-backlog.Origin
Acceptance criteria
Relationship to #577
#577 is open and already targets the OS_SDLC_TARGET fallback specifically, at file:line locations that have since shifted. This ticket absorbs #577's remaining scope and extends it to CC_OS_AGENT_ID and the Dir.pwd cwd fallbacks the audit additionally found. Do not close #577 from here; this report only states the relationship for a human to act on.
Work started 2026-09-24 in worktree branch ticket-633. Blast radius checked: TargetFlag.extract! (1 caller), WorklistTarget.load (report + 5 test sites), Backlog::Checkout (cli.rb checkout; gains --agent-id), Hook::Pipe#cwd (3 live callers), LintChanged::Trigger#directory. Decision: missing event cwd raises; agent id arrives via --agent-id. New ADR supersedes ADR-0088 env clause and amends ADR-0210 selection wording. #577 is already closed.
Resolution
Done: Removed every ENV fallback in library code. Target comes only from --target NAME or implementation.target (target_flag.rb, worklist_target.rb, worklist_report.rb, project_targets.rb error text). Backlog checkout gains --agent-id; Checkout takes agent_id: and no longer reads CC_OS_AGENT_ID. Hook::Pipe and LintChanged::Trigger take cwd from the event and raise when absent. test_helper ENV.delete removed. fix-lints and setup-project SKILL.md name --target only. ADR-0213 supersedes the ADR-0088 env clause and amends ADR-0210 rule 2 and ADR-0207. History rows added to os-sdlc and os-backlog leaves.
Evidence: Merged to main 2026-09-24, commit
7714b9ce(branch worktree-ticket-633). os-sdlc suite 1412 runs 0 failures; os-backlog suite 244 runs 0 failures. rubocop: no new offenses. grep OS_SDLC_TARGET|CC_OS_AGENT_ID over plugins returns only tests that prove the vars are ignored. Blast radius checked via os-sdlc:blast-radius before work. #577 already closed.Follow-ups: none: docs/os-sdlc-rebuild history files and older ADRs still mention OS_SDLC_TARGET as historical record, left as-is by convention; worklist_report.rb accepts --target NAME but not --target=NAME, pre-existing and unchanged; os-backlog cli.rb carries 36 pre-existing Metrics offenses, untouched