Repository navigation
feat(core): journal model calls and add chat end-to-end - #44
Merged
Merged
Conversation
- Add the ModelCall record and two JournalPort methods: modelStarted and modelCallsForRun. - Add a kind discriminator to HiveJournal records so model calls and tool invocations share one seq counter and one steps box. - Add the JournalingLlm application-layer LlmPort decorator; error text is bounded before it reaches the journal. - Replace the agentDeps DI binding with AgentDepsFactory.forRun, which wraps the raw provider per run. - Add four chat end-to-end tests covering the journaled model call. - Add ADR-0012, resolving open question Q13; the section 9 loop stays journal-free. - Update domain, storage, forbidden-glossary and plan docs, the package export and the injection tests. Refs #43
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.
Summary
ModelCallto the domain and twoJournalPortmethods (modelStarted,modelCallsForRun), so model calls are recorded before they happen (invariant 5).HiveJournalgains akinddiscriminator: model calls and tool invocations share onestepsbox and oneseqcounter.JournalingLlmdecorator, an application-layerLlmPortwrapper that journals each call and bounds error text before it is stored.AgentDepsFactory.forRun(RunId)and replaces theagentDepsDI binding with it.journaling_llm_test.dart,hive_journal_test.dartcoverage, and the matching domain/storage/plan/doc updates.Decision
ADR-0012 (resolving open question Q13): model-call journaling lives in an application-layer
LlmPortdecorator, applied per run throughAgentDepsFactory.forRun. The section 9 agent loop itself stays journal-free — it keeps receiving anLlmPortand does not learn aboutRunIdor the journal. Transcript persistence also belongs in this decorator but is deferred to plan Step 8.Review notes
Deliberate non-goals, reported during review but not fixed in this PR:
AgentDepskeeps its public primary constructor, andgetIt<LlmPort>()still returns the raw provider. Structurally preventing a bypass (private constructor,@visibleForTesting, non-default HiveinstanceName) is deferred._nextSeqhas no write lock: the monotonicsequnder concurrency currently relies on ahive_ceimplementation detail.seq-orderedrecordsForRun; tool invocations and model calls are read through separate methods._writeStartedis duplicated between the tool and model paths inHiveJournal.FakeJournal.modelStarts/modelRecordsare currently unused by tests.Acceptedalthough the ADR is not yet merged.Test evidence
melos run ci: SUCCESS — 230 tests passed.arch_check: OK (no forbidden imports).docs_check: OK.melos run gen).Refs #43