Repository navigation
Conversation
Extract the generic journal engine, GitLab conditional-file backend, protected host binding and explicit CLI operations from the contributor's reference implementation. Preserve fenced ownership, persistent budgets, parent-record predicates and immutable receipts across conservative retries. Require an independently credentialed custom journal writer, rejecting reuse of built-in assessment credentials. Keep workflow admission, dispatch, reconciliation schedules and domain semantics outside this change. Refs fullsend-ai#9253 Signed-off-by: eshulman2 <ellashulman1@gmail.com>
Site previewPreview: https://159ef19e-site.fullsend-ai.workers.dev Commit: |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
PR Summary by QodoAdd protected, repository-owned recovery journal primitives
AI Description
Merge Risk
|
Code Review by Qodo
1.
|
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
|
Addressed the seven review findings in db7ba9b, including the summary-only planned-feature callout request. Hosted conformance/migration and trace instrumentation now use linked Planned callouts. Validation: race-enabled tests for internal/cli, internal/journal, internal/journalhost and internal/forge/gitlab; make go-vet; staged make lint. All passed. The new writer-isolation check and changed parent-guard/write-classification functions have 100% local function coverage. Used GOFLAGS=-buildvcs=false for the existing local VCS-discovery environment issue. |
jflowers
left a comment
There was a problem hiding this comment.
Council verdict: REQUEST CHANGES
Seven review personas ran against main...codex/journal-primitives (d83d2ec7 → 48cc7d133). Five approved with advisories, one approved, and the testing reviewer requested changes. Consolidation lands on REQUEST CHANGES on one HIGH finding.
This PR extracts the protected-host recovery journal onto current main: a checksummed journal document with conditional transitions and ownership fencing, conditional versioned-file operations through forge.Client (GitLab backend, GitHub/Forgejo stubs), a journalhost profile with credential isolation, and the fullsend journal CLI. The engine, the forge integration, and the credential boundaries look solid overall; the gap sits in test coverage for the parent-digest contract.
Counts: 21 findings from 7 reviewers, 20 unique after cross-persona dedup (1 HIGH, 6 MEDIUM, 13 LOW). All CI checks pass on the head commit.
The blocking finding (internal/cli/journal_test.go:139, inline below): Requirement.DataDigest hashes the raw json.RawMessage bytes, while every re-marshal compacts that content. could a digest computed from journal read output, or from Admit/Update/Rebind return values, ever match requiredBackend.validateMutation for non-trivial parent data? from what I can tell the stale-parent fence then rejects every such mutation; fail-closed, but the path looks unusable. Document.checksum avoids the trap by hashing the compacted marshal. Pinning the byte representation (or canonicalizing the way checksum() does), plus a test deriving a digest from the CLI surface, would settle it.
Remaining findings not attached inline:
- test structure:
TestAdmissionOwnershipAndRestart,TestInvalidArgumentsAndMissingRecords, andTestRequiredParentStateFencesChildEffectschain 10+ scenarios each; could they split intot.Runsubtests (internal/journal/journal_test.go:36)? - defensive branches without coverage: the
Claimgeneration-overflow guard, unknowneffectID, receipt on a non-confirmed effect, and thevalidateDocumentcardinality caps (internal/journal/journal.go:171). - the operations guide could carry a protected-host journal tutorial once hosted conformance lands (
docs/guides/getting-started/operations.md:236). - positive notes worth recording: the profile validation is strict (duplicate-key rejection,
DisallowUnknownFields, HTTPS-only, traversal checks; built-in roles refused for journal credentials), and the GitLab-only initial storage with guidance to never recreate a journal is documented clearly.
Prior review context: the qodo bot flagged requirements.go:47 (parent-digest guards rejecting non-empty parents). The HIGH finding above is related but distinct; it concerns which byte representation the digest covers, not the guard logic itself.
This review was generated by /uf.review-pr (AI-assisted).
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
waynesun09
left a comment
There was a problem hiding this comment.
Review-only pass: three findings inline (two HIGH, one MEDIUM). None duplicates an existing thread.
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
waynesun09
left a comment
There was a problem hiding this comment.
Review-only pass: three MEDIUM findings inline. None duplicates an existing thread.
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
waynesun09
left a comment
There was a problem hiding this comment.
Review-only pass: three MEDIUM findings inline. None duplicates an existing thread.
| } | ||
| matched, canPush := false, false | ||
| for _, rule := range rules { | ||
| if rule.Name == "" || strings.ContainsAny(rule.Name, "\\?[] \t\r\n") { |
There was a problem hiding this comment.
MEDIUM: An unrelated protected-branch rule with a bracket, ? or space in its name disables the journal
verifyWriterIsolation checks each rule name for a blocked character (backslash, ?, [, ], space, tab, CR, LF) and returns errWriterGrants before it checks whether the rule matches the journal branch. GitLab treats only * as a wildcard in protected-branch names, so a rule named like release/[1.0] is just a literal name. Any such rule anywhere in the control project, even one for another branch, makes every journal command fail. The operator then sees "journal requires writer-only branch push, merge and unprotect grants", which sends them to the journal branch's grants instead of the rule that actually caused the failure. The tests cover an unrelated wildcard rule (other*) but not an unrelated rule with one of these characters.
Suggestion: Match the rule first, using QuoteMeta plus * -> .*, which already handles the other characters literally. Fail closed only for rules that match the journal branch, and return a rule-specific message when you do. Add a regression test with an unrelated release/[1.0] rule.
Verified: read code at head (profile.go:149-157, profile_test.go:186) at e986313; raised by: DeepSeek
| } | ||
|
|
||
| // Credential refuses built-in roles: journal writes do not widen Analyst or Poller. | ||
| func (p Profile) Credential(getenv func(string) string) (string, error) { |
There was a problem hiding this comment.
MEDIUM: The journal writer credential can be the same token or GitLab user as the Analyst, Coder or Poller roles
Credential only requires a registered custom role with credential kind own and write_repository. Nothing checks that the journal token's value, or the GitLab user behind it, differs from the other registered roles' credentials. verifyWriterIsolation confirms that "the writer user" is the only one who can push, merge and unprotect. If an operator gives the journal role the same PAT as FULLSEND_GITLAB_ANALYST_TOKEN or CODER_TOKEN, or a PAT for the same bot user, that check passes, and any process holding the assessment token can rewrite journal state. So the independent writer identity the docs require is enforced only by convention. The existing thread on line 123 dealt with branch grants, not with the writer identity overlapping another role's.
Suggestion: In Credential or the Authorizer, reject a journal token equal (constant-time compare) to any other registered role token present in the host env. Where those tokens are available, also resolve each one's /user ID and refuse when it matches the writer's ID. Add tests for both the same-value case and the same-user case.
Verified: read code at head (profile.go:66-79, 133-190) at e986313; raised by: Claude
| } | ||
| data, rev, err := b.client.ReadVersionedFile(ctx, b.location.Owner, b.location.Repo, b.location.Branch, b.location.Path) | ||
| if err != nil { | ||
| return Document{}, "", conflict(nonretryableReadError(err)) |
There was a problem hiding this comment.
MEDIUM: An uninitialized journal or missing control branch shows the generic "inspect permissions" error
Load wraps forge.ErrNotFound from ReadVersionedFile via conflict(nonretryableReadError(err)), and Initialize returns the GetBranchRef error unchanged (line 37). sanitizeJournalError recognizes journal.ErrNotFound (the record-level sentinel) and the journalhost operator sentinels, but not forge.ErrNotFound. So journal read before journal initialize, and journal initialize on a branch that does not exist, both print "journal operation failed; inspect control repository and connection permissions". The docs say the branch must already exist and that missing state needs manual recovery, but the operator never sees which case they hit. The earlier sanitizer thread (cli/journal.go:140, fixed in e986313) covered the host and JSON-input guidance strings only, not storage not-found errors.
Suggestion: In Load, map forge.ErrNotFound to a fixed sentinel such as "journal not initialized". In Initialize, map it to "journal control branch missing". Add both sentinels to sanitizeJournalError's pass-through list and keep redaction for every other error. Add CLI tests for read-before-initialize and initialize-on-missing-branch.
Verified: read code at head (journal/forge.go:32-66,148-153; cli/journal.go:128-141; journalhost/errors.go) at e986313; raised by: DeepSeek
ascerra
left a comment
There was a problem hiding this comment.
I read the docs and the forge changes at e986313. I have a follow-up for #9253 in two parts, and I don't think either belongs in this PR.
The new section covers opting in by hand (here) and says workflow integration is explicit, which matches ADR 0165 (here). What I couldn't find tracked is a setting that turns journal-backed recovery on for one repository, if the workflows Fullsend installs come to use it. I'd like that in repos.yaml, per repository and per agent, or per workflow if that's the unit that fits the ADR better. repos.yaml already declares each repository's .fullsend/config.yaml (here). The protected profile would still decide where the journal lives and who may write it (here).
The open question we added to the problem doc asks whether Fullsend should ship reusable adapters, and it points to #9253 for shared journal integration (here). Could #9253 get an item for that setting? The second part is the trace work that the command reference points to #9253 for (here). It isn't in the issue's list either, only in a comment of mine (here).
Verified: the docs and forge changes read at e986313 and compared with main ad41a65; raised by: Claude
Summary
Expose explicit protected-host journal operations for workflows that must recover across separate jobs without replaying possibly accepted external writes. This extracts the domain-neutral journal implementation from eshulman2/fullsend#1, at
618a8eacba8f6413042ee4808547891fdec6c762, onto current upstream main.The journal stores and checks mechanical progress. Existing agent runs, polling and dispatch do not opt in automatically. This draft does not migrate the CVE controller or include tracker-first orchestration, Jira admission changes, Pi tool selection or automatic schedules.
Related Issue
Partial implementation of #9253 under accepted ADR 0165. The issue remains open for hosted conformance and workflow integration.
Changes
forge.Client. GitLab uses the file'slast_commit_id, sends writes once without redirects and distinguishes definite conditional rejections from uncertain outcomes. GitHub/Forgejo control-journal storage remains unsupported.fullsend journalcommand for initialization, read/admission, leases, updates/rebinding, intents, effect confirmation and budget consumption. Only definite revision conflicts receive bounded fresh-transaction retries; ambiguous writes are held.Testing
make lintpasses with changes staged (repository-pinned link checker on PATH).GOFLAGS=-buildvcs=false make go-testpasses, including race detection and coverage. The test-only flag avoids an invalid outer/home/USER/.gitdirectory discovered by Go VCS stamping; no product behavior or repository configuration is changed.make go-vetpasses.Remaining integration and acceptance
This is a draft of the journal primitives, not completion of #9253. No live GitLab conformance test, hosted inference or publication run was performed for this extraction. Periodic reconcilers, source/domain admission, running-attempt accounting, accepted-result/evidence retention and publish-only recovery require explicit workflow integration. Journal-operation trace instrumentation/correlation, retention/compaction policy and additional storage-backend conformance remain follow-up work. Unit and HTTP-adapter tests are not distributed acceptance.
Checklist
Prepared with coding-agent assistance from the contributor's reference implementation; the personal-authorship attestation is left for the contributor.