Skip to content

Attribute case note edits and redactions to the current AI actor - #454

Merged
maximelb merged 6 commits into
masterfrom
starwatch/cases/note-edit-redact
Nov 8, 2026
Merged

maximelb merged 6 commits into
masterfrom
starwatch/cases/note-edit-redact

Conversation

@maximelb

@maximelb maximelb commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Case note edits and redactions now identify the AI actor performing the action instead of inheriting the original note author's attribution. Add optional keyword-only ai_session_id and ai_client to Cases.edit_note and Cases.redact_note. The session falls back to LC_AI_SESSION_ID, matching add_note; ai_client identifies outside AI, such as MCP. People and automation send no AI marker and are classified by the backend from caller identity.

Only nonempty markers are included. Without markers, edit requests still contain only {content} and redaction still sends a POST with no body. The CLI inherits session attribution through the SDK without new flags. Documentation explains these rules and the tests cover wire payloads, environment fallback and explicit precedence, empty values, legacy request compatibility, organization/staging routing, response preservation, and both CLI commands' session forwarding.

Validation: pytest -q tests/unit/ tests/microbenchmarks/ passes. Negative controls separately reverting redaction and edit SDK support each fail eight attribution cases while their legacy request control still passes. Runtime changes and documentation corrections are batched in this additive follow-up to merged PR #453.

Publishing remains held until staging and production are verified on the final backend source supporting both editor and redactor attribution and the pending-status correction. Actor-aware source 58c43d9 is the minimum redaction baseline; earlier eb2c75a is insufficient, and 58c43d9 alone does not establish the later edit correction. No release or tag is included.

StarWatch cases XO via StarForge

lcbill
lcbill previously approved these changes Nov 8, 2026
@limacharlie-refractionpoint

limacharlie-refractionpoint Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

LimaCharlie Cloud Security — code scan

No new code findings were introduced by this pull request.

This check reports and never fails: no gating.fail_on is set on the code_scanning policy.

Scanned refractionPOINT/python-limacharlie 52601cf…4a9c08d — only findings new in the head commit are listed; anything already on the base branch is the repository's own finding set, on the Cloud Security Code page.

This comment is updated in place on every push to this pull request.

lcbill
lcbill previously approved these changes Nov 8, 2026
@maximelb maximelb changed the title Attribute case note redaction to the current actor Attribute case note edits and redactions to the current AI actor Nov 8, 2026
@maximelb

maximelb commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/lc-review

@limacharlie-event-notifications limacharlie-event-notifications Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Code Review Summary

No high or medium priority issues found. I read all 4 changed files.

General Feedback

  • Rollout risk: Any process with LC_AI_SESSION_ID set now sends a JSON body on POST .../redact. Before this change, redaction always sent no body. If a backend that predates actor attribution rejects or mishandles a body on this endpoint, redaction from AI sessions will fail. The PR says publishing waits for backend verification. Keep that hold until both edit and redact are confirmed on staging and production.
  • Test isolation: The org fixture now clears LC_AI_SESSION_ID, so the existing legacy-body assertions no longer depend on the developer's environment. The tests that use alt_root still depend on LC_CASES_API_ROOT being unset. That was already true before this PR and is not a new problem.
  • test-time-budget: No check run was found for this commit. master does not require the check in branch protection or rulesets, so this review is not blocked on it.

Blast Radius

  • Public SDK: Cases.edit_note and Cases.redact_note gain keyword-only parameters. Existing positional calls still work.
  • Behavior change: When LC_AI_SESSION_ID is set, both methods add ai_session_id to the request without being asked. This includes the CLI commands case edit-note and case redact-note, and any tool built on the SDK that runs inside an AI session. When no markers are present, the request is the same as before.

This review was generated automatically by Claude Code.

@maximelb

maximelb commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Review read on 4a9c08d. Publishing remains held until both staging and production run the final backend source supporting editor and redactor attribution. The Release Chief must verify that exact source before tagging Python; merging this PR will not publish it. The pre-existing LC_CASES_API_ROOT test-environment dependency is unchanged. Fresh independent review of the pristine final head also approved with no findings.

@maximelb
maximelb merged commit 8891083 into master Nov 8, 2026
8 checks passed
@maximelb
maximelb deleted the starwatch/cases/note-edit-redact branch November 8, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants